List of usage examples for java.util HashSet addAll
boolean addAll(Collection<? extends E> c);
From source file:com.lines.activitys.OptionsActivity.java
/** * Here we get the number of acts in the database. "Filter" decides if we * need to filter out Acts which the selected character doesn't appear in. * // w w w.j av a 2 s . c o m * @param filter */ private void populateActs(boolean filter) { acts = new ArrayList<String>(); if (filter) { mCursor = mDbAdapter.fetchActs(mChar.getSelectedItem().toString()); } else { mCursor = mDbAdapter.fetchAllLines(); } // First get the data from "act" column if (mCursor.moveToFirst()) { do { acts.add("Act " + mCursor.getString(mCursor.getColumnIndex("act"))); } while (mCursor.moveToNext()); } // Then we remove duplicates to get exact number of acts HashSet<String> h = new HashSet<String>(); h.addAll(acts); acts.clear(); acts.addAll(h); // Set contents of Act Spinner mAdapterAct = new ArrayAdapter<String>(OptionsActivity.this, android.R.layout.simple_spinner_item, acts); mAdapterAct.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); mAct.setAdapter(mAdapterAct); mCursor.close(); }
From source file:com.eatthepath.gtfs.TransitSystem.java
public Set<Route> getRoutesForStop(final Stop stop) { final HashSet<Route> routesServingStop = new HashSet<Route>(); if (stop.isStation()) { for (final Stop childStop : stop.getChildStops()) { routesServingStop.addAll(this.getRoutesForStop(childStop)); }/*from www. ja v a 2 s .co m*/ } if (this.routesByStop.containsKey(stop)) { routesServingStop.addAll(this.routesByStop.get(stop)); } return routesServingStop; }
From source file:com.mousefeed.eclipse.NagPopUp.java
/** * Handle link activation./*from w ww. j a v a 2 s .c o m*/ */ @SuppressWarnings({ "rawtypes", "unchecked" }) final void doLinkActivated() { Object data = null; final IWorkbench workbench = Activator.getDefault().getWorkbench(); final ICommandService commandService = (ICommandService) workbench.getService(ICommandService.class); final Command command = commandService.getCommand(actionId); if (command != null) { final HashSet allParameterizedCommands = new HashSet(); try { allParameterizedCommands.addAll(ParameterizedCommand.generateCombinations(command)); } catch (final NotDefinedException e) { // It is safe to just ignore undefined commands. } if (!allParameterizedCommands.isEmpty()) { data = allParameterizedCommands.iterator().next(); // only commands can be bound to keyboard shortcuts openWorkspacePreferences(data); } } }
From source file:edu.uga.cs.fluxbuster.clustering.DomainCluster.java
/** * Gets the set of IP addresses in the cluster. * * @return the set of the IP addresses/* w ww.j a va2 s .c o m*/ */ public Set<InetAddress> getIps() { HashSet<InetAddress> retval = new HashSet<InetAddress>(); retval.addAll(this.ips); return retval; }
From source file:org.jactr.core.module.declarative.search.local.DefaultSearchSystem.java
protected Collection<IChunk> find(IConditionalSlot conditionalSlot) { HashSet<IChunk> rtn = new HashSet<IChunk>(); switch (conditionalSlot.getCondition()) { case IConditionalSlot.EQUALS: rtn.addAll(equals(conditionalSlot)); break;// w ww .j a v a 2 s.c om case IConditionalSlot.GREATER_THAN: rtn.addAll(greaterThan(conditionalSlot)); break; case IConditionalSlot.GREATER_THAN_EQUALS: rtn.addAll(greaterThan(conditionalSlot)); rtn.addAll(equals(conditionalSlot)); break; case IConditionalSlot.LESS_THAN: rtn.addAll(lessThan(conditionalSlot)); break; case IConditionalSlot.LESS_THAN_EQUALS: rtn.addAll(lessThan(conditionalSlot)); rtn.addAll(equals(conditionalSlot)); break; case IConditionalSlot.NOT_EQUALS: rtn.addAll(not(conditionalSlot)); break; case IConditionalSlot.WITHIN: default: if (LOGGER.isWarnEnabled()) LOGGER.warn("No clue what to do with this search condition " + conditionalSlot); } if (LOGGER.isDebugEnabled()) LOGGER.debug("Search for " + conditionalSlot + " yielded " + rtn.size() + " results"); return rtn; }
From source file:com.lines.activitys.OptionsActivity.java
/** * Here we get the number of pages in the database * /*from w ww . jav a 2 s. c om*/ */ private void populatePages(String act) { pages = new ArrayList<String>(); if (mChar.isEnabled()) { mCursor = mDbAdapter.fetchFilteredPages(act, mChar.getSelectedItem().toString()); } else { mCursor = mDbAdapter.fetchAllPages(act); } // First get the data from "page" column if (mCursor.moveToFirst()) { do { pages.add(mCursor.getString(mCursor.getColumnIndex("page"))); } while (mCursor.moveToNext()); } // Then we remove duplicates to get exact number of pages HashSet<String> h = new HashSet<String>(); h.addAll(pages); pages.clear(); pages.addAll(h); // Finally sort the page numbers int currentPage = findMin(pages); ArrayList<String> temp = new ArrayList<String>(); for (int i = 0; i < pages.size(); i++) { if (Integer.parseInt(pages.get(i)) == currentPage) { temp.add(pages.get(i)); pages.remove(i); i = -1; if (pages.size() > 0) { currentPage = findMin(pages); } } } // Set contents of Page Spinner mAdapterPage = new ArrayAdapter<String>(OptionsActivity.this, android.R.layout.simple_spinner_item, temp); mAdapterPage.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); mPage.setAdapter(mAdapterPage); mCursor.close(); }
From source file:de.berlios.gpon.common.ItemType.java
public Set getSpecializedTypesDeep() { HashSet nestedSpezialized = new HashSet(); if (getSpecializedTypes() != null && (!getSpecializedTypes().isEmpty())) { Iterator specializedIt = getSpecializedTypes().iterator(); while (specializedIt.hasNext()) { ItemType it = (ItemType) specializedIt.next(); nestedSpezialized.addAll(it.getSpecializedTypesDeep()); }//from www . j a v a 2 s .co m } nestedSpezialized.add(this); return nestedSpezialized; }
From source file:de.steilerdev.myVerein.server.model.Event.java
/** * This function updates the list of invited user of this event * @param divisionRepository An active division repository used to expand the division set *//*ww w .j ava2 s . c om*/ public void updateInvitedUser(DivisionRepository divisionRepository) { if (invitedDivision == null || (invitedDivision = Division.getExpandedSetOfDivisions(invitedDivision, divisionRepository)) == null) { logger.error("Unable to update invited user, because invited divisions are null!"); } else { logger.info("Updating invited user for event " + this); Set<String> oldInvitedUser = invitedUser == null ? new HashSet<>() : invitedUser.keySet(); HashSet<String> newInvitedUser = new HashSet<>(); invitedDivision.stream().forEach(div -> newInvitedUser.addAll(div.getMemberList())); if (oldInvitedUser.isEmpty() || newInvitedUser.isEmpty()) { logger.debug("Old set of invited user or new set of invited user is empty"); invitedUser = new HashMap<>(); if (oldInvitedUser.isEmpty() && !newInvitedUser.isEmpty()) { logger.debug("Old set of invited user is empty and new set of invited user is not empty"); newInvitedUser.stream().forEach(userID -> invitedUser.put(userID, EventStatus.PENDING)); } else if (newInvitedUser.isEmpty() && !oldInvitedUser.isEmpty()) { logger.debug("New set of invited user is empty and old set of invited user is not empty"); oldInvitedUser.stream().forEach(userID -> invitedUser.put(userID, EventStatus.REMOVED)); lastChanged = LocalDateTime.now(); } } else { logger.debug("Old and new set of invited user is not empty"); oldInvitedUser.removeAll(newInvitedUser); oldInvitedUser.stream().forEach(userID -> invitedUser.put(userID, EventStatus.REMOVED)); newInvitedUser.stream().forEach(userID -> invitedUser.putIfAbsent(userID, EventStatus.PENDING)); lastChanged = LocalDateTime.now(); } } }
From source file:org.alfresco.repo.security.authentication.AbstractChainingAuthenticationService.java
/** * {@inheritDoc}/*from w w w .ja va 2 s. c o m*/ */ public Set<String> getDomainsThatAllowUserCreation() { HashSet<String> domains = new HashSet<String>(); if (getMutableAuthenticationService() != null) { domains.addAll(getMutableAuthenticationService().getDomainsThatAllowUserCreation()); } return domains; }