Java Code Examples for java.util.Collections#unmodifiableSortedSet()
The following examples show how to use
java.util.Collections#unmodifiableSortedSet() .
These examples are extracted from open source projects.
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 Project: sis File: MetadataSource.java License: 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 Project: codebuff File: AbstractSortedSetMultimap.java License: 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 Project: org.openntf.domino File: BigNoteCollection.java License: 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 Project: codebuff File: Multimaps.java License: BSD 2-Clause "Simplified" License | 4 votes |
@Override public SortedSet<V> get(K key) { return Collections.unmodifiableSortedSet(delegate().get(key)); }
Example 5
Source Project: jdk8u-dev-jdk File: java_util_Collections_UnmodifiableSortedSet.java License: 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 6
Source Project: codebuff File: Sets.java License: BSD 2-Clause "Simplified" License | 4 votes |
@Override protected SortedSet<E> delegate() { return Collections.unmodifiableSortedSet(delegate); }
Example 7
Source Project: arctic-sea File: SosObservationOffering.java License: Apache License 2.0 | 4 votes |
/** * @return Sorted observation types set */ public SortedSet<String> getObservationTypes() { return Collections.unmodifiableSortedSet(observationTypes); }
Example 8
Source Project: netbeans File: CustomizerComponentFactory.java License: Apache License 2.0 | 4 votes |
public Set<NbModuleProject> getSubModules() { return Collections.unmodifiableSortedSet(subModules); }
Example 9
Source Project: pcgen File: CharacterDisplay.java License: GNU Lesser General Public License v2.1 | 4 votes |
public SortedSet<WeaponProf> getSortedWeaponProfs() { return Collections.unmodifiableSortedSet(new TreeSet<>(weaponProfFacet.getSet(id))); }
Example 10
Source Project: codebuff File: Tables.java License: BSD 2-Clause "Simplified" License | 4 votes |
@Override public SortedSet<R> rowKeySet() { return Collections.unmodifiableSortedSet(delegate().rowKeySet()); }
Example 11
Source Project: openjdk-jdk8u-backup File: java_util_Collections_UnmodifiableSortedSet.java License: 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 12
Source Project: arctic-sea File: SosObservationOffering.java License: Apache License 2.0 | 4 votes |
/** * @return Sorted featureOfInterest list */ public SortedSet<String> getFeatureOfInterest() { return Collections.unmodifiableSortedSet(featureOfInterest); }
Example 13
Source Project: jdk8u-jdk File: java_util_Collections_UnmodifiableSortedSet.java License: GNU General Public License v2.0 | 4 votes |
protected SortedSet<String> getAnotherObject() { SortedSet<String> set = new TreeSet<String>(); return Collections.unmodifiableSortedSet(set); }
Example 14
Source Project: arctic-sea File: SosObservationOffering.java License: Apache License 2.0 | 4 votes |
public SortedSet<String> getFeatureOfInterestTypes() { return Collections.unmodifiableSortedSet(featureOfInterestTypes); }
Example 15
Source Project: openjdk-8-source File: java_util_Collections_UnmodifiableSortedSet.java License: 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 16
Source Project: openjdk-8 File: java_util_Collections_UnmodifiableSortedSet.java License: 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 17
Source Project: openjdk-jdk8u File: java_util_Collections_UnmodifiableSortedSet.java License: 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 18
Source Project: arctic-sea File: OwsHttp.java License: Apache License 2.0 | 4 votes |
public SortedSet<OwsRequestMethod> getRequestMethods() { return Collections.unmodifiableSortedSet(requestMethods); }
Example 19
Source Project: pcgen File: CharacterDisplay.java License: GNU Lesser General Public License v2.1 | 4 votes |
public SortedSet<WeaponProf> getSortedWeaponProfs() { return Collections.unmodifiableSortedSet(new TreeSet<>(weaponProfFacet.getSet(id))); }
Example 20
Source Project: xtext-lib File: CollectionExtensions.java License: 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); }