Exemple #1
0
  @Test
  public void singletonSortedSet() {
    SortedSet<Integer> set = new TreeSet<Integer>();
    set.add(1);

    this.verify(Collections.<Integer>singletonSortedSet(1), set, 0, 1);
  }
Exemple #2
0
  @Test
  public void singletonSortedMap() {
    SortedMap<Integer, String> map = new TreeMap<Integer, String>();
    map.put(1, "");

    this.verify(Collections.<Integer, String>singletonSortedMap(1, ""), map, 0, 1, "");
  }
Exemple #3
0
    @Override
    public SortedMap<K, V> subMap(K fromKey, K toKey) {
      Comparator<K> comparator = naturalComparator();

      return ((comparator.compare(this.entry.getKey(), toKey) < 0)
              && (comparator.compare(this.entry.getKey(), fromKey) >= 0))
          ? this
          : Collections.<K, V>emptySortedMap();
    }
Exemple #4
0
    @Override
    public SortedSet<E> subSet(E fromElement, E toElement) {
      Comparator<E> comparator = naturalComparator();

      return ((comparator.compare(this.element, toElement) < 0)
              && (comparator.compare(this.element, fromElement) >= 0))
          ? this
          : Collections.<E>emptySortedSet();
    }
Exemple #5
0
 @Override
 public SortedMap<K, V> tailMap(K fromKey) {
   return (naturalComparator().compare(this.entry.getKey(), fromKey) >= 0)
       ? this
       : Collections.<K, V>emptySortedMap();
 }
Exemple #6
0
 @Override
 public SortedMap<K, V> headMap(K toKey) {
   return (naturalComparator().compare(this.entry.getKey(), toKey) < 0)
       ? this
       : Collections.<K, V>emptySortedMap();
 }
Exemple #7
0
 @Override
 public SortedSet<E> tailSet(E fromElement) {
   return (naturalComparator().compare(this.element, fromElement) >= 0)
       ? this
       : Collections.<E>emptySortedSet();
 }
Exemple #8
0
 @Override
 public SortedSet<E> headSet(E toElement) {
   return (naturalComparator().compare(this.element, toElement) < 0)
       ? this
       : Collections.<E>emptySortedSet();
 }
Exemple #9
0
 @Test
 public void emptySortedSet() {
   this.verify(Collections.<Integer>emptySortedSet(), new TreeSet<Integer>(), 0, 1);
 }
Exemple #10
0
 @Test
 public void emptySortedMap() {
   this.verify(
       Collections.<Integer, String>emptySortedMap(), new TreeMap<Integer, String>(), 0, 1, "");
 }