当前位置: 首页>>代码示例>>Java>>正文


Java Collections.unmodifiableSortedSet方法代码示例

本文整理汇总了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);
}
 
开发者ID:LightSun,项目名称:Visitor,代码行数:28,代码来源:InternalUtil.java

示例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);
  }
}
 
开发者ID:paul-hammant,项目名称:googles-monorepo-demo,代码行数:14,代码来源:AbstractMapBasedMultimap.java

示例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);
}
 
开发者ID:s-store,项目名称:s-store,代码行数:20,代码来源:Multimaps.java

示例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());
  }
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:10,代码来源:AbstractSortedSetMultimap.java

示例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);
}
 
开发者ID:paul-hammant,项目名称:googles-monorepo-demo,代码行数:19,代码来源:Multimaps.java

示例6: getAuthorsShingles

import java.util.Collections; //导入方法依赖的package包/类
public SortedSet<String> getAuthorsShingles() {
    if (authorsShingles == null) {
        authorsShingles = calculateShingles(authors, authorsShingleLenght);
    }

    return Collections.unmodifiableSortedSet(authorsShingles);
}
 
开发者ID:HewlettPackard,项目名称:loom,代码行数:8,代码来源:CoraRecord.java

示例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);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:22,代码来源:TIFFTagSet.java

示例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();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:59,代码来源:SingleModuleProperties.java

示例9: createElementSet

import java.util.Collections; //导入方法依赖的package包/类
@Override
SortedSet<E> createElementSet() {
  return Collections.unmodifiableSortedSet(delegate().elementSet());
}
 
开发者ID:zugzug90,项目名称:guava-mock,代码行数:5,代码来源:UnmodifiableSortedMultiset.java

示例10: delegate

import java.util.Collections; //导入方法依赖的package包/类
@Override
protected SortedSet<E> delegate() {
  return Collections.unmodifiableSortedSet(delegate);
}
 
开发者ID:paul-hammant,项目名称:googles-monorepo-demo,代码行数:5,代码来源:Sets.java

示例11: getIncludedDates

import java.util.Collections; //导入方法依赖的package包/类
public SortedSet<Date> getIncludedDates() {
    return Collections.unmodifiableSortedSet(workdays);
}
 
开发者ID:youseries,项目名称:uflo,代码行数:4,代码来源:WorkdayCalendar.java

示例12: get

import java.util.Collections; //导入方法依赖的package包/类
@Override
public SortedSet<V> get(K key) {
  return Collections.unmodifiableSortedSet(delegate().get(key));
}
 
开发者ID:paul-hammant,项目名称:googles-monorepo-demo,代码行数:5,代码来源:Multimaps.java

示例13: getObject

import java.util.Collections; //导入方法依赖的package包/类
protected SortedSet<String> getObject() {
    SortedSet<String> set = new TreeSet<String>();
    set.add("string");
    return Collections.unmodifiableSortedSet(set);
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:6,代码来源:java_util_Collections_UnmodifiableSortedSet.java

示例14: getClasses

import java.util.Collections; //导入方法依赖的package包/类
/**
 * @return classes
 */
public SortedSet<Class<E>> getClasses() {
	return Collections.unmodifiableSortedSet(new TreeSet<>(classes.values()));
}
 
开发者ID:willemsrb,项目名称:sonar-packageanalyzer-plugin,代码行数:7,代码来源:Package.java

示例15: get

import java.util.Collections; //导入方法依赖的package包/类
@Override public SortedSet<V> get(K key) {
  return Collections.unmodifiableSortedSet(delegate().get(key));
}
 
开发者ID:s-store,项目名称:s-store,代码行数:4,代码来源:Multimaps.java


注:本文中的java.util.Collections.unmodifiableSortedSet方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。