List of usage examples for com.google.common.collect Sets newHashSet
public static <E> HashSet<E> newHashSet()
From source file:org.apache.kylin.metadata.expression.ExpressionColCollector.java
public static Set<TblColRef> collectColumns(TupleExpression tupleExpression) { Pair<Set<TblColRef>, Set<TblColRef>> pairRet = collectColumnsPair(tupleExpression); Set<TblColRef> ret = Sets.newHashSet(); ret.addAll(pairRet.getFirst());/*from w w w.ja v a 2 s .c o m*/ ret.addAll(pairRet.getSecond()); return ret; }
From source file:com.enonic.cms.web.webdav.DavSessionImpl.java
public DavSessionImpl() { this.lockTokens = Sets.newHashSet(); }
From source file:edu.cmu.lti.oaqa.framework.eval.retrieval.EvaluationHelper.java
public static <T> Set<String> getStringSet(List<T> results, Function<T, String> toIdString) { Set<String> set = Sets.newHashSet(); for (T result : results) { set.add(toIdString.apply(result)); }/*from w ww . ja v a 2s . com*/ return set; }
From source file:org.opentestsystem.authoring.testauth.validation.ValidationHelper.java
@SuppressWarnings("unchecked") public static <T> ConstraintViolationException convertErrorsToConstraintException(final T validatedObject, final Errors errors) { if (errors.hasErrors()) { final Set<ConstraintViolation<?>> violations = Sets.newHashSet(); for (final FieldError error : errors.getFieldErrors()) { final ConstraintViolation<T> violation = ConstraintViolationImpl.forBeanValidation(error.getCode(), org.springframework.util.StringUtils.arrayToCommaDelimitedString(error.getArguments()), (Class<T>) validatedObject.getClass(), validatedObject, validatedObject, error.getRejectedValue() == null ? "" : error.getRejectedValue(), PathImpl.createPathFromString(error.getField()), null, ElementType.FIELD); violations.add(violation);/*from w ww .ja va2 s . co m*/ } for (final ObjectError error : errors.getGlobalErrors()) { final ConstraintViolation<T> violation = ConstraintViolationImpl.forBeanValidation( error.getDefaultMessage(), org.springframework.util.StringUtils.arrayToCommaDelimitedString(error.getArguments()), (Class<T>) validatedObject.getClass(), validatedObject, validatedObject, "", PathImpl.createPathFromString(error.getObjectName()), null, ElementType.TYPE); violations.add(violation); } return new ConstraintViolationException(violations); } return null; }
From source file:com.google.dart.compiler.ast.LibraryImport.java
private static Set<String> createCombinatorsSet(List<ImportCombinator> combinators, boolean show) { Set<String> result = Sets.newHashSet(); for (ImportCombinator combinator : combinators) { // show/* w ww.j a va2 s . c om*/ if (show && combinator instanceof ImportShowCombinator) { ImportShowCombinator showCombinator = (ImportShowCombinator) combinator; for (DartIdentifier showName : showCombinator.getShownNames()) { if (showName != null) { result.add(showName.getName()); } } } // hide if (!show && combinator instanceof ImportHideCombinator) { ImportHideCombinator hideCombinator = (ImportHideCombinator) combinator; for (DartIdentifier hideName : hideCombinator.getHiddenNames()) { if (hideName != null) { result.add(hideName.getName()); } } } } return result; }
From source file:com.google.devtools.depan.model.RelationSets.java
public static Collection<Relation> filterRelations(RelationSet filter, Collection<Relation> source) { Set<Relation> result = Sets.newHashSet(); for (Relation relation : source) { if (filter.contains(relation)) { result.add(relation);/* w w w . j a va 2s. c om*/ } } return result; }
From source file:qa.qcri.qnoise.model.ModelBase.java
public ModelBase() { log = Sets.newHashSet(); }
From source file:cuchaz.enigma.analysis.EntryRenamer.java
public static <Key, Val> void renameClassesInMap(Map<String, String> renames, Map<Key, Val> map) { // for each key/value pair... Set<Map.Entry<Key, Val>> entriesToAdd = Sets.newHashSet(); for (Map.Entry<Key, Val> entry : map.entrySet()) { entriesToAdd.add(new AbstractMap.SimpleEntry<>(renameClassesInThing(renames, entry.getKey()), renameClassesInThing(renames, entry.getValue()))); }//from ww w. j a v a 2 s . c o m map.clear(); for (Map.Entry<Key, Val> entry : entriesToAdd) { map.put(entry.getKey(), entry.getValue()); } }
From source file:com.atlassian.jira.bc.license.MockLicenseRole.java
public MockLicenseRole() { this.groups = Sets.newHashSet(); }
From source file:com.basho.riak.presto.PRSchema.java
public static PRSchema example() { Set<String> ts = Sets.newHashSet(); Set<String> s = Sets.newHashSet("tse;lkajsdf"); PRSchema prs = new PRSchema(ts, s); prs.addTable("foobartable"); return prs;// w ww . ja v a2 s . c o m }