List of usage examples for java.util Set addAll
boolean addAll(Collection<? extends E> c);
From source file:gov.jgi.meta.MetaUtils.java
/** * generate a set (unique) of all sequences ({ATGC} only) from start sequence * to distance steps (Hamming distance)//from w w w. j a va2 s . c o m * * @param start the start sequence * @param distance the number of steps to travel * @return s set containing all neighbors including itself. */ public static Set<String> generateAllNeighbors(StringBuffer start, int distance) { char[] bases = { 'a', 't', 'g', 'c' }; Set<String> s = new HashSet<String>(); if (distance == 0) { s.add(start.toString()); return (s); } for (int i = 0; i < start.length(); i++) { char old = start.charAt(i); for (char basePair : bases) { start.setCharAt(i, basePair); s.addAll(generateAllNeighbors(start, distance - 1)); } start.setCharAt(i, old); } return (s); }
From source file:net.eusashead.hateoas.header.impl.AllowHeaderImpl.java
public AllowHeaderImpl(HttpMethod... methods) { Set<HttpMethod> allowed = new TreeSet<HttpMethod>(); allowed.addAll(Arrays.asList(methods)); this.methods = allowed; }
From source file:cz.fi.muni.pa165.comparator.SortByPoints.java
private Set<Game> getGamesDraw(Team t) { Set<Game> gamesD = new HashSet<>(); gamesD.addAll(games.stream().filter(g -> g.getMatchResult().equals(MatchResult.DRAW)) .filter(g -> g.getGuestTeam().equals(t) || g.getHomeTeam().equals(t)).collect(Collectors.toSet())); return gamesD; }
From source file:ca.simplegames.micro.utils.StringUtils.java
/** * Remove duplicate Strings from the given array. * Also sorts the array, as it uses a TreeSet. * * @param array the String array/*from w ww . j a v a 2 s . c o m*/ * @return an array without duplicates, in natural sort order */ public static String[] removeDuplicateStrings(String[] array) { if (ObjectUtils.isEmpty(array)) { return array; } Set set = new TreeSet(); set.addAll(Arrays.asList(array)); return toStringArray(set); }
From source file:cz.fi.muni.pa165.comparator.SortByPoints.java
private Set<Game> getGamesWon(Team t) { Set<Game> gamesW = new HashSet<>(); gamesW.addAll(games.stream().filter(g -> g.getHomeTeam().equals(t)) .filter(g -> g.getMatchResult().equals(MatchResult.HOME_TEAM_WIN)).collect(Collectors.toSet())); gamesW.addAll(games.stream().filter(g -> g.getGuestTeam().equals(t)) .filter(g -> g.getMatchResult().equals(MatchResult.GUEST_TEAM_WIN)).collect(Collectors.toSet())); return gamesW; }
From source file:org.apache.streams.messaging.aggregation.ActivityAggregator.java
public void updateSubscriber(ActivityStreamsSubscriber subscriber) { Set<String> activities = new TreeSet<String>(); activities.addAll(activityService.getActivitiesForFilters( subscriber.getActivityStreamsSubscriberConfiguration().getFilters(), subscriber.getLastUpdated())); //TODO: an activity posted in between the cql query and setting the lastUpdated field will be lost subscriber.setLastUpdated(new Date()); subscriber.receive(new ArrayList<String>(activities)); }
From source file:com.nzion.util.UtilMisc.java
public static <T> Set<T> makeSetWritable(Collection<? extends T> col) { Set<T> result = new HashSet<T>(); if (col != null) result.addAll(col); return result; }
From source file:com.espertech.esper.rowregex.EventRowRegexHelper.java
/** * Inspect variables recursively./*from w w w . ja v a 2 s .c om*/ * @param parent parent regex expression node * @param isMultiple if the variable in the stack is multiple of single * @param variablesSingle single variables list * @param variablesMultiple group variables list */ protected static void recursiveInspectVariables(RowRegexExprNode parent, boolean isMultiple, Set<String> variablesSingle, Set<String> variablesMultiple) { if (parent instanceof RowRegexExprNodeNested) { RowRegexExprNodeNested nested = (RowRegexExprNodeNested) parent; for (RowRegexExprNode child : parent.getChildNodes()) { recursiveInspectVariables(child, nested.getType().isMultipleMatches() || isMultiple, variablesSingle, variablesMultiple); } } else if (parent instanceof RowRegexExprNodeAlteration) { for (RowRegexExprNode childAlteration : parent.getChildNodes()) { LinkedHashSet<String> singles = new LinkedHashSet<String>(); LinkedHashSet<String> multiples = new LinkedHashSet<String>(); recursiveInspectVariables(childAlteration, isMultiple, singles, multiples); variablesMultiple.addAll(multiples); variablesSingle.addAll(singles); } variablesSingle.removeAll(variablesMultiple); } else if (parent instanceof RowRegexExprNodeAtom) { RowRegexExprNodeAtom atom = (RowRegexExprNodeAtom) parent; String name = atom.getTag(); if (variablesMultiple.contains(name)) { return; } if (variablesSingle.contains(name)) { variablesSingle.remove(name); variablesMultiple.add(name); return; } if (atom.getType().isMultipleMatches()) { variablesMultiple.add(name); return; } if (isMultiple) { variablesMultiple.add(name); } else { variablesSingle.add(name); } } else { for (RowRegexExprNode child : parent.getChildNodes()) { recursiveInspectVariables(child, isMultiple, variablesSingle, variablesMultiple); } } }
From source file:com.technofovea.hl2parse.vdf.PropDataReader.java
public Set<String> getAllGibs() { Set<String> ret = new HashSet<String>(); ret.addAll(getRagdollModels()); ret.addAll(getRigidGibModels());// www .j a va 2 s.co m return ret; }
From source file:com.cimpoint.mes.server.services.BatchServiceImpl.java
@Override public Set<String> findBatchNumbersByWorkOrderItemNumber(String workOrderItemNumber) throws Exception { Set<String> result = new HashSet<String>(); result.addAll(batchRepository.findBatchsByWorkOrderItemNumber(workOrderItemNumber)); return result; }