Java Code Examples for java.util.Collections#unmodifiableSortedSet()
The following examples show how to use
java.util.Collections#unmodifiableSortedSet() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MetadataSource.java From sis with Apache License 2.0 | 5 votes |
@SuppressWarnings({"unchecked","rawtypes"}) private static <E> Collection<?> specialize(Collection<?> collection, final Class<?> returnType, final Class<E> elementType) { if (!returnType.isAssignableFrom(Set.class)) { return collection; } final Set<E> enumeration; if (CodeList.class.isAssignableFrom(elementType)) { enumeration = new CodeListSet<>((Class) elementType); } else if (Enum.class.isAssignableFrom(elementType)) { enumeration = EnumSet.noneOf((Class) elementType); } else { /* * If 'returnType' is Collection.class, do not copy into a Set since a List * is probably good enough. Copy only if a Set is explicitly requested. */ if (Set.class.isAssignableFrom(returnType)) { if (SortedSet.class.isAssignableFrom(returnType)) { if (collection.isEmpty()) { collection = Collections.emptySortedSet(); } else { collection = Collections.unmodifiableSortedSet(new TreeSet<>(collection)); } } else { switch (collection.size()) { case 0: collection = Collections.emptySet(); break; case 1: collection = Collections.singleton(CollectionsExt.first(collection)); break; default: collection = Collections.unmodifiableSet(new LinkedHashSet<>(collection)); break; } } } return collection; } for (final Object e : collection) { enumeration.add(elementType.cast(e)); } return Collections.unmodifiableSet(enumeration); }
Example 2
Source File: AbstractSortedSetMultimap.java From codebuff with BSD 2-Clause "Simplified" License | 5 votes |
@Override SortedSet<V> createUnmodifiableEmptyCollection() { Comparator<? super V> comparator = valueComparator(); if (comparator == null) { return Collections.unmodifiableSortedSet(createCollection()); } else { return ImmutableSortedSet.emptySet(valueComparator()); } }
Example 3
Source File: BigNoteCollection.java From org.openntf.domino with Apache License 2.0 | 5 votes |
@Override public Iterator<String> iterator() { final Map<String, int[]> map = getIdMap(); Set<String> set; synchronized (map) { set = Collections.unmodifiableSortedSet((SortedSet<String>) map.keySet()); } return set.iterator(); }
Example 4
Source File: CharacterDisplay.java From pcgen with GNU Lesser General Public License v2.1 | 4 votes |
public SortedSet<WeaponProf> getSortedWeaponProfs() { return Collections.unmodifiableSortedSet(new TreeSet<>(weaponProfFacet.getSet(id))); }
Example 5
Source File: Multimaps.java From codebuff with BSD 2-Clause "Simplified" License | 4 votes |
@Override public SortedSet<V> get(K key) { return Collections.unmodifiableSortedSet(delegate().get(key)); }
Example 6
Source File: OwsHttp.java From arctic-sea with Apache License 2.0 | 4 votes |
public SortedSet<OwsRequestMethod> getRequestMethods() { return Collections.unmodifiableSortedSet(requestMethods); }
Example 7
Source File: java_util_Collections_UnmodifiableSortedSet.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
protected SortedSet<String> getObject() { SortedSet<String> set = new TreeSet<String>(); set.add("string"); return Collections.unmodifiableSortedSet(set); }
Example 8
Source File: java_util_Collections_UnmodifiableSortedSet.java From openjdk-8 with GNU General Public License v2.0 | 4 votes |
protected SortedSet<String> getObject() { SortedSet<String> set = new TreeSet<String>(); set.add("string"); return Collections.unmodifiableSortedSet(set); }
Example 9
Source File: java_util_Collections_UnmodifiableSortedSet.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
protected SortedSet<String> getObject() { SortedSet<String> set = new TreeSet<String>(); set.add("string"); return Collections.unmodifiableSortedSet(set); }
Example 10
Source File: SosObservationOffering.java From arctic-sea with Apache License 2.0 | 4 votes |
public SortedSet<String> getFeatureOfInterestTypes() { return Collections.unmodifiableSortedSet(featureOfInterestTypes); }
Example 11
Source File: java_util_Collections_UnmodifiableSortedSet.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
protected SortedSet<String> getAnotherObject() { SortedSet<String> set = new TreeSet<String>(); return Collections.unmodifiableSortedSet(set); }
Example 12
Source File: SosObservationOffering.java From arctic-sea with Apache License 2.0 | 4 votes |
/** * @return Sorted featureOfInterest list */ public SortedSet<String> getFeatureOfInterest() { return Collections.unmodifiableSortedSet(featureOfInterest); }
Example 13
Source File: java_util_Collections_UnmodifiableSortedSet.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
protected SortedSet<String> getObject() { SortedSet<String> set = new TreeSet<String>(); set.add("string"); return Collections.unmodifiableSortedSet(set); }
Example 14
Source File: Tables.java From codebuff with BSD 2-Clause "Simplified" License | 4 votes |
@Override public SortedSet<R> rowKeySet() { return Collections.unmodifiableSortedSet(delegate().rowKeySet()); }
Example 15
Source File: CharacterDisplay.java From pcgen with GNU Lesser General Public License v2.1 | 4 votes |
public SortedSet<WeaponProf> getSortedWeaponProfs() { return Collections.unmodifiableSortedSet(new TreeSet<>(weaponProfFacet.getSet(id))); }
Example 16
Source File: CustomizerComponentFactory.java From netbeans with Apache License 2.0 | 4 votes |
public Set<NbModuleProject> getSubModules() { return Collections.unmodifiableSortedSet(subModules); }
Example 17
Source File: SosObservationOffering.java From arctic-sea with Apache License 2.0 | 4 votes |
/** * @return Sorted observation types set */ public SortedSet<String> getObservationTypes() { return Collections.unmodifiableSortedSet(observationTypes); }
Example 18
Source File: Sets.java From codebuff with BSD 2-Clause "Simplified" License | 4 votes |
@Override protected SortedSet<E> delegate() { return Collections.unmodifiableSortedSet(delegate); }
Example 19
Source File: java_util_Collections_UnmodifiableSortedSet.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 4 votes |
protected SortedSet<String> getObject() { SortedSet<String> set = new TreeSet<String>(); set.add("string"); return Collections.unmodifiableSortedSet(set); }
Example 20
Source File: CollectionExtensions.java From xtext-lib with Eclipse Public License 2.0 | 2 votes |
/** * Returns an unmodifiable view of the specified sorted {@code set}. * * @param set * the sorted set for which an unmodifiable view is to be returned. May not be <code>null</code>. * @return an unmodifiable view of the specified sorted set. * @see Collections#unmodifiableSortedSet(SortedSet) */ @Inline(value="$2.$3unmodifiableSortedSet($1)", imported=Collections.class) public static <T> SortedSet<T> unmodifiableView(SortedSet<T> set) { return Collections.unmodifiableSortedSet(set); }