private List<GlobalItem> getSingleDevices(int type) { List<GlobalItem> selected = new ArrayList<GlobalItem>(); for (GlobalItem globalItem : allItems) { if ((globalItem.getType() & type) != 0) selected.add(globalItem); } return selected; }
private List<GlobalItem> getGroups(int type) { Map<Integer, Integer> map = new HashMap<Integer, Integer>(); List<GlobalItem> selected = new ArrayList<GlobalItem>(); for (GlobalItem globalItem : allItems) { if (!map.containsKey(globalItem.getGroup()) && ((globalItem.getType() * 4) & type) != 0) { map.put(globalItem.getGroup(), globalItem.getType() * 4); selected.add( new GlobalItem( groupNames.get(globalItem.getGroup()), globalItem.getGroup(), -1, globalItem.getType() * 4, globalItem.getAdapter())); } } return selected; }