List of usage examples for com.google.common.collect Sets newTreeSet
public static <E extends Comparable> TreeSet<E> newTreeSet()
From source file:eu.interedition.text.util.Ranges.java
public static SortedSet<TextRange> compressAdjacent(SortedSet<TextRange> ranges) { final SortedSet<TextRange> compressed = Sets.newTreeSet(); TextRange current = null;//from ww w .j av a2 s .c o m for (Iterator<TextRange> rangeIt = ranges.iterator(); rangeIt.hasNext();) { final TextRange range = rangeIt.next(); if (current == null) { current = new TextRange(range); } else { if (current.getEnd() == range.getStart()) { current = new TextRange(current.getStart(), range.getEnd()); } else { compressed.add(current); current = new TextRange(range); } } if (!rangeIt.hasNext()) { compressed.add(current); } } return compressed; }
From source file:blockplus.model.polyomino.PolyominoInstances.java
private static SortedSet<IPosition> flipPositions(final Iterable<IPosition> positions, final IPosition referential) { final SortedSet<IPosition> newPositions = Sets.newTreeSet(); for (final IPosition position : positions) newPositions.add(flipPosition(position, referential)); return newPositions; }
From source file:com.google.gerrit.sshd.commands.CacheCommand.java
protected SortedSet<String> cacheNames() { SortedSet<String> names = Sets.newTreeSet(); for (DynamicMap.Entry<Cache<?, ?>> e : cacheMap) { names.add(cacheNameOf(e.getPluginName(), e.getExportName())); }/*w ww . ja v a2s .c o m*/ return names; }
From source file:ezbake.security.api.ua.Authorizations.java
public Authorizations() { this.level = ""; this.auths = Sets.newTreeSet(); this.communityAuthorizations = Sets.newTreeSet(); this.citizenship = ""; this.organization = ""; }
From source file:org.gradle.cache.internal.UsedGradleVersionsFromGradleUserHomeCaches.java
@Override public SortedSet<GradleVersion> getUsedGradleVersions() { SortedSet<GradleVersion> result = Sets.newTreeSet(); for (VersionSpecificCacheDirectory cacheDir : directoryScanner.getExistingDirectories()) { result.add(cacheDir.getVersion()); }//from w w w . ja va 2 s .com return result; }
From source file:org.jboss.hal.ballroom.form.BlacklistValidation.java
public BlacklistValidation(final String first, final String... rest) { this.blacklist = Sets.newTreeSet(); this.blacklist.add(first); if (rest != null) { this.blacklist.addAll(asList(rest)); }/*w w w. j av a 2 s.c om*/ }
From source file:de.xaniox.heavyspleef.core.event.EventBus.java
protected EventBus(Logger logger) { this.logger = logger; this.registeredEventListeners = Sets.newTreeSet(); }
From source file:org.apache.isis.core.runtime.services.ServicesInstallerUtils.java
static <V> void appendInPosition(SortedMap<String, SortedSet<String>> positionedServices, String position, String service) {/*from w w w . ja va 2s. c o m*/ if (service == null) { return; } SortedSet<String> serviceList = positionedServices.get(position); if (serviceList == null) { serviceList = Sets.newTreeSet(); positionedServices.put(position, serviceList); } serviceList.add(service); }
From source file:org.apache.shindig.common.util.StringEncoding.java
/** Creates a new encoding based on the supplied set of digits. */ public StringEncoding(final char[] userDigits) { TreeSet<Character> t = Sets.newTreeSet(); for (char c : userDigits) { t.add(c);//w w w.jav a2s. c om } char[] digits = new char[t.size()]; int i = 0; for (char c : t) { digits[i++] = c; } this.DIGITS = digits; this.MASK = digits.length - 1; this.SHIFT = Integer.numberOfTrailingZeros(MASK + 1); if ((MASK + 1) != (1 << SHIFT) || digits.length >= 256) { throw new AssertionError(Arrays.toString(digits)); } }
From source file:com.nomsic.sid.Simset.java
public Simset(String response_id) { this.recordSet = Sets.newTreeSet(); this.recordSet.add(response_id); }