@Override public Set<E> uniqueSet() { return decorated().uniqueSet(); }
@Override public Set<E> uniqueSet() { return decorated().uniqueSet(); }
/** * Returns <code>true</code> if the bag contains all elements in the given * collection, respecting cardinality. * * @param other the bag to check against * @return <code>true</code> if the Bag contains all the collection */ boolean containsAll(final Bag<?> other) { final Iterator<?> it = other.uniqueSet().iterator(); while (it.hasNext()) { final Object current = it.next(); if (getCount(current) < other.getCount(current)) { return false; } } return true; }
@Override public Set<E> uniqueSet() { final Set<E> set = decorated().uniqueSet(); return UnmodifiableSet.<E> unmodifiableSet(set); }
@Override public Set<E> uniqueSet() { final Set<E> set = getBag().uniqueSet(); return TransformedSet.<E>transformingSet(set, transformer); }
@Override public Set<E> uniqueSet() { synchronized (lock) { final Set<E> set = getBag().uniqueSet(); return new SynchronizedBagSet(set, lock); } }
private static List<String> getBagAsUniqueList(Bag<String> bag) { List<String> excludedTagList = new ArrayList<>(); excludedTagList.addAll(bag.uniqueSet()); return excludedTagList; }
/** * @param specFile to parse * @return all tags used in spec */ public static Collection<String> getTags(File specFile) { try { Bag<String> tags = new HashBag<>(); List<String> lines = FileUtils.readLines(specFile); for (String line : lines) { String trimmedLine = line.trim(); if (StringUtils.startsWith(trimmedLine, PATTERN_LINE_WITH_TAGS_IN_SPEC)) { String tagsAsString = StringUtils.removeStart(trimmedLine, PATTERN_LINE_WITH_TAGS_IN_SPEC); String[] tagsAsArray = tagsAsString.split(","); for (String tag : tagsAsArray) { if (StringUtils.isNotBlank(tag)) { String cleanedTag = tag.trim().replaceAll("[^A-Za-z0-9]*", ""); if (StringUtils.isNotBlank(cleanedTag)) { tags.add(cleanedTag); } } } } } return tags.uniqueSet(); } catch (IOException ex) { throw new GaleniumException("when parsing '" + specFile + "'"); } }