本文整理汇总了Java中java.util.Collections.unmodifiableSortedSet方法的典型用法代码示例。如果您正苦于以下问题:Java Collections.unmodifiableSortedSet方法的具体用法?Java Collections.unmodifiableSortedSet怎么用?Java Collections.unmodifiableSortedSet使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.util.Collections
的用法示例。
在下文中一共展示了Collections.unmodifiableSortedSet方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: unmodifiable
import java.util.Collections; //导入方法依赖的package包/类
/**
* auto Adaptation List, NavigableSet, SortedSet, Set and Collection.
*
* @param <T>
* the element type
* @param collection
* the target collection
* @return a unmodifiable collection
*/
public static <T> Collection<T> unmodifiable(Collection<T> collection) {
if (collection instanceof List) {
return Collections.unmodifiableList((List<? extends T>) collection);
}
/*
* else if (collection instanceof NavigableSet) {
* if(JDKVersion.isJdK18()){ //jdk1.8 return
* Collections.unmodifiableNavigableSet((NavigableSet<T>) collection); }
* }
*/
else if (collection instanceof SortedSet) {
return Collections.unmodifiableSortedSet((SortedSet<T>) collection);
} else if (collection instanceof Set) {
return Collections.unmodifiableSet((Set<? extends T>) collection);
}
return Collections.unmodifiableCollection(collection);
}
示例2: unmodifiableCollectionSubclass
import java.util.Collections; //导入方法依赖的package包/类
static <E> Collection<E> unmodifiableCollectionSubclass(Collection<E> collection) {
if (collection instanceof NavigableSet) {
return Sets.unmodifiableNavigableSet((NavigableSet<E>) collection);
} else if (collection instanceof SortedSet) {
return Collections.unmodifiableSortedSet((SortedSet<E>) collection);
} else if (collection instanceof Set) {
return Collections.unmodifiableSet((Set<E>) collection);
} else if (collection instanceof List) {
return Collections.unmodifiableList((List<E>) collection);
} else {
return Collections.unmodifiableCollection(collection);
}
}
示例3: unmodifiableValueCollection
import java.util.Collections; //导入方法依赖的package包/类
/**
* Returns an unmodifiable view of the specified collection, preserving the
* interface for instances of {@code SortedSet}, {@code Set}, {@code List} and
* {@code Collection}, in that order of preference.
*
* @param collection the collection for which to return an unmodifiable view
* @return an unmodifiable view of the collection
*/
private static <V> Collection<V> unmodifiableValueCollection(
Collection<V> collection) {
if (collection instanceof SortedSet) {
return Collections.unmodifiableSortedSet((SortedSet<V>) collection);
} else if (collection instanceof Set) {
return Collections.unmodifiableSet((Set<V>) collection);
} else if (collection instanceof List) {
return Collections.unmodifiableList((List<V>) collection);
}
return Collections.unmodifiableCollection(collection);
}
示例4: createUnmodifiableEmptyCollection
import java.util.Collections; //导入方法依赖的package包/类
@Override
SortedSet<V> createUnmodifiableEmptyCollection() {
Comparator<? super V> comparator = valueComparator();
if (comparator == null) {
return Collections.unmodifiableSortedSet(createCollection());
} else {
return ImmutableSortedSet.emptySet(valueComparator());
}
}
示例5: unmodifiableValueCollection
import java.util.Collections; //导入方法依赖的package包/类
/**
* Returns an unmodifiable view of the specified collection, preserving the
* interface for instances of {@code SortedSet}, {@code Set}, {@code List} and
* {@code Collection}, in that order of preference.
*
* @param collection the collection for which to return an unmodifiable view
* @return an unmodifiable view of the collection
*/
private static <V> Collection<V> unmodifiableValueCollection(Collection<V> collection) {
if (collection instanceof SortedSet) {
return Collections.unmodifiableSortedSet((SortedSet<V>) collection);
} else if (collection instanceof Set) {
return Collections.unmodifiableSet((Set<V>) collection);
} else if (collection instanceof List) {
return Collections.unmodifiableList((List<V>) collection);
}
return Collections.unmodifiableCollection(collection);
}
示例6: getAuthorsShingles
import java.util.Collections; //导入方法依赖的package包/类
public SortedSet<String> getAuthorsShingles() {
if (authorsShingles == null) {
authorsShingles = calculateShingles(authors, authorsShingleLenght);
}
return Collections.unmodifiableSortedSet(authorsShingles);
}
示例7: getTagNames
import java.util.Collections; //导入方法依赖的package包/类
/**
* Retrieves an unmodifiable lexicographically increasing set of tag names.
*
* <p>The returned object is unmodifiable and contains the tag
* names of all {@code TIFFTag}s in this {@code TIFFTagSet}
* sorted into ascending order according to
* {@link String#compareTo(Object)}.</p>
*
* @return All tag names in this set.
*/
public SortedSet<String> getTagNames() {
Set<String> tagNames = allowedTagsByName.keySet();
SortedSet<String> sortedTagNames;
if(tagNames instanceof SortedSet) {
sortedTagNames = (SortedSet<String>)tagNames;
} else {
sortedTagNames = new TreeSet<String>(tagNames);
}
return Collections.unmodifiableSortedSet(sortedTagNames);
}
示例8: refresh
import java.util.Collections; //导入方法依赖的package包/类
protected void refresh(NbModuleType moduleType,
SuiteProvider suiteProvider) {
reloadProperties();
// reset
this.suiteProvider = suiteProvider;
this.moduleType = moduleType;
universeDependencies = null;
modCategories = null;
availablePublicPackages = null;
dependencyListModel = null;
friendListModel = null;
requiredTokensListModel = null;
wrappedJarsListModel = null;
wrappedJarsChanged = false;
projectXMLManager = null;
if (isSuiteComponent()) {
if (getSuiteDirectory() != null) {
ModuleList.refreshModuleListForRoot(getSuiteDirectory());
}
} else if (isStandalone()) {
ModuleList.refreshModuleListForRoot(getProjectDirectoryFile());
}
ManifestManager manifestManager = ManifestManager.getInstance(getManifestFile(), false);
majorReleaseVersion = manifestManager.getReleaseVersion();
specificationVersion = manifestManager.getSpecificationVersion();
implementationVersion = manifestManager.getImplementationVersion();
provTokensString = manifestManager.getProvidedTokensString();
autoUpdateShowInClient = manifestManager.getAutoUpdateShowInClient();
String nbDestDirS = getEvaluator().getProperty(ModuleList.NETBEANS_DEST_DIR);
LOG.log(Level.FINE, "Setting NBPlatform for module. '" + getCodeNameBase() + "' in dir '" + nbDestDirS + "'");
if (nbDestDirS != null) {
String harnessDir = getEvaluator().getProperty("harness.dir");
NbPlatform plaf = NbPlatform.getPlatformByDestDir(getHelper().resolveFile(nbDestDirS), harnessDir != null ? getHelper().resolveFile(harnessDir) : null);
if (!plaf.isValid()) { // #134492
NbPlatform def = NbPlatform.getDefaultPlatform();
if (def != null) {
LOG.log(Level.FINE, "Platform not found, switching to default ({0})", def.getDestDir());
plaf = def;
}
}
originalPlatform = activePlatform = plaf;
}
activeJavaPlatform = getJavaPlatform();
javaPlatformChanged = false;
getPublicPackagesModel().reloadData(loadPublicPackages());
requiredTokens = Collections.unmodifiableSortedSet(
new TreeSet<String>(Arrays.asList(manifestManager.getRequiredTokens())));
bundleInfo = bundleInfoProvider.getLocalizedBundleInfo();
if (bundleInfo != null) {
try {
bundleInfo.reload();
} catch (IOException ioe) {
ErrorManager.getDefault().notify(ioe);
}
}
firePropertiesRefreshed();
}
示例9: createElementSet
import java.util.Collections; //导入方法依赖的package包/类
@Override
SortedSet<E> createElementSet() {
return Collections.unmodifiableSortedSet(delegate().elementSet());
}
示例10: delegate
import java.util.Collections; //导入方法依赖的package包/类
@Override
protected SortedSet<E> delegate() {
return Collections.unmodifiableSortedSet(delegate);
}
示例11: getIncludedDates
import java.util.Collections; //导入方法依赖的package包/类
public SortedSet<Date> getIncludedDates() {
return Collections.unmodifiableSortedSet(workdays);
}
示例12: get
import java.util.Collections; //导入方法依赖的package包/类
@Override
public SortedSet<V> get(K key) {
return Collections.unmodifiableSortedSet(delegate().get(key));
}
示例13: getObject
import java.util.Collections; //导入方法依赖的package包/类
protected SortedSet<String> getObject() {
SortedSet<String> set = new TreeSet<String>();
set.add("string");
return Collections.unmodifiableSortedSet(set);
}
示例14: getClasses
import java.util.Collections; //导入方法依赖的package包/类
/**
* @return classes
*/
public SortedSet<Class<E>> getClasses() {
return Collections.unmodifiableSortedSet(new TreeSet<>(classes.values()));
}
示例15: get
import java.util.Collections; //导入方法依赖的package包/类
@Override public SortedSet<V> get(K key) {
return Collections.unmodifiableSortedSet(delegate().get(key));
}