Java Code Examples for java.util.Collections#emptyNavigableMap()

The following examples show how to use java.util.Collections#emptyNavigableMap() . 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: StorageUtils.java    From amodeus with GNU General Public License v2.0 6 votes vote down vote up
/** @return {@link NavigableMap} to with {@link Integer} and {@link File} for
 *         the first available iteration. */
public NavigableMap<Integer, File> getFirstAvailableIteration() {
    if (!directory.isDirectory()) { // no simobj directory
        System.out.println("no files found");
        return Collections.emptyNavigableMap();
    }

    File[] files = Stream.of(directory.listFiles()).sorted().toArray(File[]::new);

    if (files.length == 0) {
        System.out.println("no files found");
        return Collections.emptyNavigableMap();
    }

    File lastIter = files[files.length - 1];
    System.out.println("loading last Iter = " + lastIter);
    return getFrom(lastIter);
}
 
Example 2
Source File: CollectionFieldsBuilder.java    From auto-matter with Apache License 2.0 5 votes vote down vote up
public CollectionFields build() {
  List<String> _strings = (strings != null) ? Collections.unmodifiableList(new ArrayList<String>(strings)) : Collections.<String>emptyList();
  Map<String, Integer> _integers = (integers != null) ? Collections.unmodifiableMap(new HashMap<String, Integer>(integers)) : Collections.<String, Integer>emptyMap();
  SortedMap<String, Integer> _sortedIntegers = (sortedIntegers != null) ? Collections.unmodifiableSortedMap(new TreeMap<String, Integer>(sortedIntegers)) : Collections.<String, Integer>emptySortedMap();
  NavigableMap<String, Integer> _navigableIntegers = (navigableIntegers != null) ? Collections.unmodifiableNavigableMap(new TreeMap<String, Integer>(navigableIntegers)) : Collections.<String, Integer>emptyNavigableMap();
  Set<Long> _numbers = (numbers != null) ? Collections.unmodifiableSet(new HashSet<Long>(numbers)) : Collections.<Long>emptySet();
  SortedSet<Long> _sortedNumbers = (sortedNumbers != null) ? Collections.unmodifiableSortedSet(new TreeSet<Long>(sortedNumbers)) : Collections.<Long>emptySortedSet();
  NavigableSet<Long> _navigableNumbers = (navigableNumbers != null) ? Collections.unmodifiableNavigableSet(new TreeSet<Long>(navigableNumbers)) : Collections.<Long>emptyNavigableSet();
  return new Value(_strings, _integers, _sortedIntegers, _navigableIntegers, _numbers, _sortedNumbers, _navigableNumbers);
}
 
Example 3
Source File: CollectionFieldsBuilder.java    From auto-matter with Apache License 2.0 5 votes vote down vote up
private Value(@AutoMatter.Field("strings") List<String> strings, @AutoMatter.Field("integers") Map<String, Integer> integers, @AutoMatter.Field("sortedIntegers") SortedMap<String, Integer> sortedIntegers, @AutoMatter.Field("navigableIntegers") NavigableMap<String, Integer> navigableIntegers, @AutoMatter.Field("numbers") Set<Long> numbers, @AutoMatter.Field("sortedNumbers") SortedSet<Long> sortedNumbers, @AutoMatter.Field("navigableNumbers") NavigableSet<Long> navigableNumbers) {
  this.strings = (strings != null) ? strings : Collections.<String>emptyList();
  this.integers = (integers != null) ? integers : Collections.<String, Integer>emptyMap();
  this.sortedIntegers = (sortedIntegers != null) ? sortedIntegers : Collections.<String, Integer>emptySortedMap();
  this.navigableIntegers = (navigableIntegers != null) ? navigableIntegers : Collections.<String, Integer>emptyNavigableMap();
  this.numbers = (numbers != null) ? numbers : Collections.<Long>emptySet();
  this.sortedNumbers = (sortedNumbers != null) ? sortedNumbers : Collections.<Long>emptySortedSet();
  this.navigableNumbers = (navigableNumbers != null) ? navigableNumbers : Collections.<Long>emptyNavigableSet();
}
 
Example 4
Source File: CollectionsTest.java    From j2objc with Apache License 2.0 5 votes vote down vote up
public void test_emptyNavigableMap() {
    NavigableMap<String, Integer> map = Collections.emptyNavigableMap();
    check_unmodifiableNavigableMap_defaultMethods(
            map,
            new ArrayList<>() /* keysInOrder */,
            new ArrayList<>() /* valuesInOrder */,
            "absent key" /* absentKey */,
            -1 /* absentValue */
    );
    check_unmodifiableNavigableMap_collectionViews(
            map,
            new ArrayList<>() /* keysInOrder */,
            new ArrayList<>() /* valuesInOrder */,
            "absent key" /* absentKey */);
}
 
Example 5
Source File: CheckAndMutate.java    From hbase with Apache License 2.0 5 votes vote down vote up
private CheckAndMutate(byte[] row, byte[] family, byte[] qualifier,final CompareOperator op,
  byte[] value, TimeRange timeRange, Row action) {
  super(row, HConstants.LATEST_TIMESTAMP, Collections.emptyNavigableMap());
  this.family = family;
  this.qualifier = qualifier;
  this.op = op;
  this.value = value;
  this.filter = null;
  this.timeRange = timeRange;
  this.action = action;
}
 
Example 6
Source File: CheckAndMutate.java    From hbase with Apache License 2.0 5 votes vote down vote up
private CheckAndMutate(byte[] row, Filter filter, TimeRange timeRange, Row action) {
  super(row, HConstants.LATEST_TIMESTAMP, Collections.emptyNavigableMap());
  this.family = null;
  this.qualifier = null;
  this.op = null;
  this.value = null;
  this.filter = filter;
  this.timeRange = timeRange;
  this.action = action;
}
 
Example 7
Source File: CollectionHelper.java    From ph-commons with Apache License 2.0 5 votes vote down vote up
@Nonnull
@ReturnsImmutableObject
@CodingStyleguideUnaware
public static <KEYTYPE extends Comparable <? super KEYTYPE>, VALUETYPE> NavigableMap <KEYTYPE, VALUETYPE> makeUnmodifiableNotNull (@Nullable final NavigableMap <KEYTYPE, VALUETYPE> aNavigableMap)
{
  return aNavigableMap == null ? Collections.emptyNavigableMap ()
                               : Collections.unmodifiableNavigableMap (aNavigableMap);
}
 
Example 8
Source File: ChrPosTreeMap.java    From systemsgenetics with GNU General Public License v3.0 5 votes vote down vote up
public NavigableMap<Integer,E> getChrRange(String chr, Integer fromKey, boolean fromInclusive, Integer toKey, boolean toInclusive){
	
	TreeMap<Integer, E> chrElements = data.get(chr);
	if(chrElements == null){
		return Collections.emptyNavigableMap();
	} else {
		return chrElements.subMap(fromKey, fromInclusive, toKey, toInclusive);
	}
	
}
 
Example 9
Source File: InternalTestCluster.java    From crate with Apache License 2.0 5 votes vote down vote up
@Override
public synchronized void close() throws IOException {
    if (this.open.compareAndSet(true, false)) {
        if (activeDisruptionScheme != null) {
            activeDisruptionScheme.testClusterClosed();
            activeDisruptionScheme = null;
        }
        try {
            IOUtils.close(nodes.values());
        } finally {
            nodes = Collections.emptyNavigableMap();
            executor.shutdownNow();
        }
    }
}
 
Example 10
Source File: DebugStorageRangeAt.java    From besu with Apache License 2.0 4 votes vote down vote up
private JsonRpcSuccessResponse emptyResponse(final JsonRpcRequestContext requestContext) {
  return new JsonRpcSuccessResponse(
      requestContext.getRequest().getId(),
      new DebugStorageRangeAtResult(Collections.emptyNavigableMap(), null, shortValues));
}
 
Example 11
Source File: DebugAccountRange.java    From besu with Apache License 2.0 4 votes vote down vote up
private JsonRpcSuccessResponse emptyResponse(final JsonRpcRequestContext requestContext) {
  return new JsonRpcSuccessResponse(
      requestContext.getRequest().getId(),
      new DebugAccountRangeAtResult(Collections.emptyNavigableMap(), null));
}
 
Example 12
Source File: DummyStorageSupplier.java    From amodeus with GNU General Public License v2.0 4 votes vote down vote up
public DummyStorageSupplier() {
    super(Collections.emptyNavigableMap());
}
 
Example 13
Source File: ClusterInfo.java    From sfs with Apache License 2.0 4 votes vote down vote up
public NavigableMap<Long, Set<String>> getStartedVolumeIdByUseableSpace() {
    NavigableMap<Long, Set<String>> snapshot = startedVolumeIdByUseableSpace;
    return snapshot != null ? snapshot : Collections.emptyNavigableMap();
}
 
Example 14
Source File: GitLabProject.java    From git-as-svn with GNU General Public License v2.0 4 votes vote down vote up
@NotNull
@Override
public NavigableMap<String, GitBranch> getBranches() {
  return ready ? repository.getBranches() : Collections.emptyNavigableMap();
}
 
Example 15
Source File: GiteaProject.java    From git-as-svn with GNU General Public License v2.0 4 votes vote down vote up
@NotNull
@Override
public NavigableMap<String, GitBranch> getBranches() {
  return ready ? repository.getBranches() : Collections.emptyNavigableMap();
}