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


Java SortedSet类代码示例

本文整理汇总了Java中java.util.SortedSet的典型用法代码示例。如果您正苦于以下问题:Java SortedSet类的具体用法?Java SortedSet怎么用?Java SortedSet使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


SortedSet类属于java.util包,在下文中一共展示了SortedSet类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: listMediaFiles

import java.util.SortedSet; //导入依赖的package包/类
public static SortedSet<File> listMediaFiles(File dir)
{
	SortedSet<File> files = listFiles(dir);
	Iterator<File> iterator = files.iterator();

	while (iterator.hasNext())
	{
		File file = iterator.next();

		if (!file.isDirectory() && !isMediaFile(file))
		{
			iterator.remove();
		}
	}

	return files;
}
 
开发者ID:ultrasonic,项目名称:ultrasonic,代码行数:18,代码来源:FileUtil.java

示例2: testNoProperties2

import java.util.SortedSet; //导入依赖的package包/类
@Test(expected = NullPointerException.class)
public void testNoProperties2() throws Exception {
    try (XmlFileStorageAdapter storage = new XmlFileStorageAdapter()) {
        storage.persistConfig(new ConfigSnapshotHolder() {
            @Override
            public String getConfigSnapshot() {
                return mock(String.class);
            }

            @Override
            public SortedSet<String> getCapabilities() {
                return new TreeSet<>();
            }
        });
    }
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:17,代码来源:FileStorageAdapterTest.java

示例3: setLineMap

import java.util.SortedSet; //导入依赖的package包/类
private void setLineMap(Code_attribute attr) {
    SortedMap<Integer, SortedSet<Integer>> map =
            new TreeMap<Integer, SortedSet<Integer>>();
    SortedSet<Integer> allLines = new TreeSet<Integer>();
    for (Attribute a: attr.attributes) {
        if (a instanceof LineNumberTable_attribute) {
            LineNumberTable_attribute t = (LineNumberTable_attribute) a;
            for (LineNumberTable_attribute.Entry e: t.line_number_table) {
                int start_pc = e.start_pc;
                int line = e.line_number;
                SortedSet<Integer> pcLines = map.get(start_pc);
                if (pcLines == null) {
                    pcLines = new TreeSet<Integer>();
                    map.put(start_pc, pcLines);
                }
                pcLines.add(line);
                allLines.add(line);
            }
        }
    }
    lineMap = map;
    lineList = new ArrayList<Integer>(allLines);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:24,代码来源:SourceWriter.java

示例4: prefixStr2Set

import java.util.SortedSet; //导入依赖的package包/类
/**
 * Decodes the <code>inclusiveNamespaces</code> String and returns all
 * selected namespace prefixes as a Set. The <code>#default</code>
 * namespace token is represented as an empty namespace prefix
 * (<code>"xmlns"</code>).
 * <BR/>
 * The String <code>inclusiveNamespaces=" xenc    ds #default"</code>
 * is returned as a Set containing the following Strings:
 * <UL>
 * <LI><code>xmlns</code></LI>
 * <LI><code>xenc</code></LI>
 * <LI><code>ds</code></LI>
 * </UL>
 *
 * @param inclusiveNamespaces
 * @return A set to string
 */
public static SortedSet<String> prefixStr2Set(String inclusiveNamespaces) {
    SortedSet<String> prefixes = new TreeSet<String>();

    if ((inclusiveNamespaces == null) || (inclusiveNamespaces.length() == 0)) {
        return prefixes;
    }

    String[] tokens = inclusiveNamespaces.split("\\s");
    for (String prefix : tokens) {
        if (prefix.equals("#default")) {
            prefixes.add("xmlns");
        } else {
            prefixes.add(prefix);
        }
    }

    return prefixes;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:36,代码来源:InclusiveNamespaces.java

示例5: toConfigSnapshot

import java.util.SortedSet; //导入依赖的package包/类
public ConfigSnapshotHolder toConfigSnapshot(final ConfigSnapshot configSnapshot) {
    return new ConfigSnapshotHolder() {
        @Override
        public String getConfigSnapshot() {
            return configSnapshot.getConfigSnapshot();
        }

        @Override
        public SortedSet<String> getCapabilities() {
            return configSnapshot.getCapabilities();
        }

        @Override
        public String toString() {
            return configSnapshot.toString();
        }
    };
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:19,代码来源:XmlFileStorageAdapter.java

示例6: isDescending

import java.util.SortedSet; //导入依赖的package包/类
public static final boolean isDescending(SortedSet<?> set) {
    if (null == set.comparator()) {
        // natural order
        return false;
    }

    if (Collections.reverseOrder() == set.comparator()) {
        // reverse natural order.
        return true;
    }

    if (set.comparator().equals(Collections.reverseOrder(Collections.reverseOrder(set.comparator())))) {
        // it's a Collections.reverseOrder(Comparator).
        return true;
    }

    throw new IllegalStateException("can't determine ordering for " + set);
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:19,代码来源:EmptyNavigableSet.java

示例7: getGroupsNotAssignedToBranch

import java.util.SortedSet; //导入依赖的package包/类
@Override
   public SortedSet<Group> getGroupsNotAssignedToBranch(Long branchingActivityID) throws LessonServiceException {

BranchingActivity branchingActivity = (BranchingActivity) getActivityById(branchingActivityID);
if (branchingActivity == null) {
    String error = "getGroupsNotAssignedToBranch: Branching Activity missing missing. ActivityID was "
	    + branchingActivityID;
    MonitoringService.log.error(error);
    throw new MonitoringServiceException(error);
}

TreeSet<Group> unassignedGroups = new TreeSet<Group>();

Grouping grouping = branchingActivity.getGrouping();
Iterator groupIterator = grouping.getGroups().iterator();
while (groupIterator.hasNext()) {
    Group group = (Group) groupIterator.next();
    if ((group.getBranchActivities() == null) || (group.getBranchActivities().size() == 0)) {
	unassignedGroups.add(group);
    }
}

return unassignedGroups;

   }
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:26,代码来源:MonitoringService.java

示例8: loadSpaces

import java.util.SortedSet; //导入依赖的package包/类
public List<SpaceDTO> loadSpaces(String namespace) {
    List<SpaceDTO> answer = new ArrayList<>();
    if (namespace != null) {
        try {
            Spaces spacesValue = Spaces.load(kubernetesClient, namespace);
            if (spacesValue != null) {
                SortedSet<Space> spaces = spacesValue.getSpaceSet();
                for (Space space : spaces) {
                    answer.add(new SpaceDTO(space.getName(), space.getName()));
                }
            }
        } catch (Exception e) {
            LOG.warn("Failed to load spaces: " + e, e);
        }
    }
    return answer;
}
 
开发者ID:fabric8-launcher,项目名称:launcher-backend,代码行数:18,代码来源:KubernetesClientHelper.java

示例9: testSubSetContents2

import java.util.SortedSet; //导入依赖的package包/类
public void testSubSetContents2() {
    NavigableSet set = set5();
    SortedSet sm = set.subSet(two, three);
    assertEquals(1, sm.size());
    assertEquals(two, sm.first());
    assertEquals(two, sm.last());
    assertFalse(sm.contains(one));
    assertTrue(sm.contains(two));
    assertFalse(sm.contains(three));
    assertFalse(sm.contains(four));
    assertFalse(sm.contains(five));
    Iterator i = sm.iterator();
    Object k;
    k = (Integer)(i.next());
    assertEquals(two, k);
    assertFalse(i.hasNext());
    Iterator j = sm.iterator();
    j.next();
    j.remove();
    assertFalse(set.contains(two));
    assertEquals(4, set.size());
    assertEquals(0, sm.size());
    assertTrue(sm.isEmpty());
    assertFalse(sm.remove(three));
    assertEquals(4, set.size());
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:27,代码来源:TreeSubSetTest.java

示例10: createSessionMap

import java.util.SortedSet; //导入依赖的package包/类
/**
    * Updates SessionMap using Notebook content.
    *
    * @param notebook
    * @param mode
    */
   private SessionMap<String, Object> createSessionMap(Notebook notebook, ToolAccessMode mode, String contentFolderID,
    Long toolContentID) {

SessionMap<String, Object> map = new SessionMap<String, Object>();

map.put(AuthoringAction.KEY_MODE, mode);
map.put(AuthoringAction.KEY_CONTENT_FOLDER_ID, contentFolderID);
map.put(AuthoringAction.KEY_TOOL_CONTENT_ID, toolContentID);
map.put(NotebookConstants.ATTR_DELETED_CONDITION_LIST, new ArrayList<NotebookCondition>());

SortedSet<NotebookCondition> set = new TreeSet<NotebookCondition>(new TextSearchConditionComparator());

if (notebook.getConditions() != null) {
    set.addAll(notebook.getConditions());
}
map.put(NotebookConstants.ATTR_CONDITION_SET, set);
return map;
   }
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:25,代码来源:AuthoringAction.java

示例11: unmodifiable

import java.util.SortedSet; //导入依赖的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

示例12: getProjectLibraries

import java.util.SortedSet; //导入依赖的package包/类
public Set<File> getProjectLibraries() {
	Set<File> classpath = new HashSet<>();

	SourceSetContainer sourceSets = (SourceSetContainer) project.getProperties().get("sourceSets");

	if (sourceSets != null) {
		SortedSet<String> availableSourceSetNames = sourceSets.getNames();
		for (String sourceSetName : Arrays.asList("main", "test", "integrationTest")) {
			if (availableSourceSetNames.contains(sourceSetName)) {
				SourceSet sourceSet = sourceSets.getByName(sourceSetName);
				classpath.add(sourceSet.getOutput().getClassesDir());
			}
		}
	}

	// add  dependencies from configured gradle configuration to url (usually test or integrationTest)
	TSGeneratorConfig generatorConfiguration = project.getExtensions().getByType(TSGeneratorConfig.class);
	String configurationName = generatorConfiguration.getRuntime().getConfiguration();

	ConfigurationContainer configurations = project.getConfigurations();
	Configuration runtimeConfiguration = configurations.findByName(configurationName + "Runtime");
	if (runtimeConfiguration == null) {
		runtimeConfiguration = configurations.getByName(configurationName);
	}
	classpath.addAll(runtimeConfiguration.getFiles());

	for (File file : classpath) {
		LOGGER.debug("classpath entry: {}", file);
	}

	return classpath;
}
 
开发者ID:crnk-project,项目名称:crnk-framework,代码行数:33,代码来源:RuntimeClassLoaderFactory.java

示例13: getNodes

import java.util.SortedSet; //导入依赖的package包/类
/**
 * Returns the set of nodes in this cell. Only call after
 * the cell has been completely fixed.
 */
public SortedSet<RuleNode> getNodes() {
    setFixed();
    if (this.nodes == null) {
        this.nodes = computeNodes();
    }
    return this.nodes;
}
 
开发者ID:meteoorkip,项目名称:JavaGraph,代码行数:12,代码来源:RuleModel.java

示例14: assertNotEqualLenient

import java.util.SortedSet; //导入依赖的package包/类
private static void assertNotEqualLenient(
    TreeSet<?> unexpected, SortedSet<?> actual) {
  try {
    assertThat(actual).isNotEqualTo(unexpected);
  } catch (ClassCastException accepted) {
  }
}
 
开发者ID:paul-hammant,项目名称:googles-monorepo-demo,代码行数:8,代码来源:ImmutableSortedSetTest.java

示例15: testNullSafeAddAllWithEmptySet

import java.util.SortedSet; //导入依赖的package包/类
@Test
public void testNullSafeAddAllWithEmptySet(){
	SortedSet<String> set = new TreeSet<>();
	set.add("b");
	Set<String> toAdd = new HashSet<>();
	toAdd.add("a");
	set = nullSafeSortedAddAll(set, toAdd);
	set.add("c");
	Assert.assertEquals(new String[]{"a", "b", "c"}, set.toArray());
}
 
开发者ID:hotpads,项目名称:datarouter,代码行数:11,代码来源:SetTool.java


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