List of usage examples for com.google.common.collect ImmutableSortedSet copyOfSorted
@SuppressWarnings("unchecked") public static <E> ImmutableSortedSet<E> copyOfSorted(SortedSet<E> sortedSet)
From source file:de.cubicvoxel.openspacebox.ingame.faction.log.FactionLog.java
public SortedSet<LogEntry> getEntries() { return ImmutableSortedSet.copyOfSorted(logEntries); }
From source file:com.gradleware.tooling.toolingmodel.repository.internal.DefaultOmniTaskSelector.java
public void setSelectedTaskPaths(SortedSet<Path> selectedTaskPaths) { this.selectedTaskPaths = ImmutableSortedSet.copyOfSorted(selectedTaskPaths); }
From source file:me.lucko.luckperms.common.api.delegates.PermissionHolderDelegate.java
@Override public SortedSet<? extends Node> getPermissions() { return ImmutableSortedSet.copyOfSorted(master.getPermissions(false)); }
From source file:me.lucko.luckperms.common.data.Log.java
public Log(SortedSet<LogEntry> content) { this.content = ImmutableSortedSet.copyOfSorted(content); }
From source file:me.lucko.luckperms.common.actionlog.Log.java
public Log(SortedSet<ExtendedLogEntry> content) { this.content = ImmutableSortedSet.copyOfSorted(content); }
From source file:me.lucko.luckperms.common.api.delegates.model.ApiPermissionHolder.java
@Override public SortedSet<? extends Node> getPermissions() { return ImmutableSortedSet.copyOfSorted(handle.getOwnNodesSorted()); }
From source file:com.google.javascript.jscomp.deps.NodeModuleResolver.java
/** * Build a list of node module paths. Given the following path: * * <p>/foo/node_modules/bar/node_modules/baz/foo_bar_baz.js * * <p>Return a set containing:// w ww . j a v a 2 s . com * * <p>/foo/ /foo/node_modules/bar/ * * @param modulePaths Set of all module paths where the key is the module path normalized to have * a leading slash * @param moduleRootPaths Possibly empty list of root paths that should be ignored when processing * module paths. * @return A sorted set with the longest paths first where each entry is the folder containing a * node_modules sub-folder. */ private static ImmutableSortedSet<String> buildNodeModulesFoldersRegistry(Iterable<String> modulePaths, Iterable<String> moduleRootPaths) { SortedSet<String> registry = new TreeSet<>( // TODO(b/28382956): Take better advantage of Java8 comparing() to simplify this (a, b) -> { // Order longest path first int comparison = Integer.compare(b.length(), a.length()); if (comparison != 0) { return comparison; } return a.compareTo(b); }); // For each modulePath, find all the node_modules folders // There might be more than one: // /foo/node_modules/bar/node_modules/baz/foo_bar_baz.js // Should add: // /foo/ -> bar/node_modules/baz/foo_bar_baz.js // /foo/node_modules/bar/ -> baz/foo_bar_baz.js // // If there are root paths provided - they should be ignored from paths. For example if // root paths contains "/generated" root then the following module path should produce exact // same result as above: // /generated/foo/node_modules/bar/node_modules/baz/foo_bar_baz.js for (String modulePath : modulePaths) { // Strip root path from the beginning if it matches any. for (String moduleRootPath : moduleRootPaths) { if (modulePath.startsWith(moduleRootPath)) { modulePath = modulePath.substring(moduleRootPath.length()); break; } } String[] nodeModulesDirs = modulePath.split("/node_modules/"); String parentPath = ""; for (int i = 0; i < nodeModulesDirs.length - 1; i++) { if (i + 1 < nodeModulesDirs.length) { parentPath += nodeModulesDirs[i] + "/"; } registry.add(parentPath); parentPath += "node_modules/"; } } return ImmutableSortedSet.copyOfSorted(registry); }
From source file:com.opengamma.basics.date.ImmutableHolidayCalendar.java
/** * Creates an instance calculating the supported range. * //from ww w. ja v a 2 s.co m * @param name the calendar name * @param holidays the set of holidays, validated non-null * @param weekendDays the set of weekend days, validated non-null */ @ImmutableConstructor private ImmutableHolidayCalendar(String name, SortedSet<LocalDate> holidays, Set<DayOfWeek> weekendDays) { ArgChecker.notNull(name, "name"); ArgChecker.notNull(holidays, "holidays"); ArgChecker.notNull(weekendDays, "weekendDays"); this.name = name; this.holidays = ImmutableSortedSet.copyOfSorted(holidays); this.weekendDays = Sets.immutableEnumSet(weekendDays); if (holidays.isEmpty()) { // special case where no holiday dates are specified this.range = LocalDateRange.ALL; this.startYear = 0; this.lookup = new int[0]; } else { // normal case where holidays are specified this.range = LocalDateRange.ofClosed(holidays.first().with(TemporalAdjusters.firstDayOfYear()), holidays.last().with(TemporalAdjusters.lastDayOfYear())); this.startYear = range.getStart().getYear(); int endYearExclusive = range.getEndExclusive().getYear(); this.lookup = buildLookupArray(holidays, weekendDays, startYear, endYearExclusive); } }
From source file:com.opengamma.strata.basics.date.ImmutableHolidayCalendar.java
/** * Creates an instance calculating the supported range. * /*from www. j a v a 2 s . c o m*/ * @param name the calendar name * @param holidays the set of holidays, validated non-null * @param weekendDays the set of weekend days, validated non-null */ @ImmutableConstructor private ImmutableHolidayCalendar(HolidayCalendarId id, SortedSet<LocalDate> holidays, Set<DayOfWeek> weekendDays) { ArgChecker.notNull(id, "id"); ArgChecker.notNull(holidays, "holidays"); ArgChecker.notNull(weekendDays, "weekendDays"); this.id = id; this.holidays = ImmutableSortedSet.copyOfSorted(holidays); this.weekendDays = Sets.immutableEnumSet(weekendDays); if (holidays.isEmpty()) { // special case where no holiday dates are specified this.startYear = 0; this.lookup = new int[0]; } else { // normal case where holidays are specified this.startYear = holidays.first().getYear(); int endYearExclusive = holidays.last().getYear() + 1; this.lookup = buildLookupArray(holidays, weekendDays, startYear, endYearExclusive); } }
From source file:org.eclipse.xtext.xbase.lib.CollectionExtensions.java
/** * Returns an immutable copy of the specified sorted {@code set}. * //from w w w . j a v a 2 s .c o m * @param set * the sorted set for which an immutable copy should be created. May not be <code>null</code>. * @return an immutable copy of the specified sorted set. */ @Inline(value = "$2.$3copyOfSorted($1)", imported = ImmutableSortedSet.class) public static <T> SortedSet<T> immutableCopy(SortedSet<T> set) { return ImmutableSortedSet.copyOfSorted(set); }