java.util.AbstractSequentialList Java Examples

The following examples show how to use java.util.AbstractSequentialList. 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: LinkedListMultimap.java    From codebuff with BSD 2-Clause "Simplified" License 6 votes vote down vote up
/**
 * {@inheritDoc}
 *
 * <p>If the multimap is modified while an iteration over the list is in
 * progress (except through the iterator's own {@code add}, {@code set} or
 * {@code remove} operations) the results of the iteration are undefined.
 *
 * <p>The returned list is not serializable and does not have random access.
 */

@Override
public List<V> get(final @Nullable K key) {
  return new AbstractSequentialList<V>() {
    @Override
    public int size() {
      KeyList<K, V> keyList = keyToKeyList.get(key);
      return (keyList == null) ? 0 : keyList.count;
    }

    @Override
    public ListIterator<V> listIterator(int index) {
      return new ValueForKeyIterator(key, index);
    }
  };
}
 
Example #2
Source File: LinkedListMultimap.java    From codebuff with BSD 2-Clause "Simplified" License 6 votes vote down vote up
@Override
List<Entry<K, V>> createEntries() {
  @WeakOuter
  class EntriesImpl extends AbstractSequentialList<Entry<K, V>> {
    @Override
    public int size() {
      return size;
    }

    @Override
    public ListIterator<Entry<K, V>> listIterator(int index) {
      return new NodeIterator(index);
    }
  }
  return new EntriesImpl();
}
 
Example #3
Source File: LinkedListMultimap.java    From codebuff with BSD 2-Clause "Simplified" License 6 votes vote down vote up
/**
 * {@inheritDoc}
 *
 * <p>If the multimap is modified while an iteration over the list is in
 * progress (except through the iterator's own {@code add}, {@code set} or
 * {@code remove} operations) the results of the iteration are undefined.
 *
 * <p>The returned list is not serializable and does not have random access.
 */

@Override
public List<V> get(final @Nullable K key) {
  return new AbstractSequentialList<V>() {
    @Override
    public int size() {
      KeyList<K, V> keyList = keyToKeyList.get(key);
      return (keyList == null) ? 0 : keyList.count;
    }

    @Override
    public ListIterator<V> listIterator(int index) {
      return new ValueForKeyIterator(key, index);
    }
  };
}
 
Example #4
Source File: JavaGraphLoader.java    From Ferma with Apache License 2.0 6 votes vote down vote up
public FramedGraph load() {
    Graph graph = TinkerGraph.open();
    final FramedGraph framedGraph = new DelegatingFramedGraph(graph, true, JAVA_TYPE_TYPES);

    // Interfaces
    Vertex collection = makeInterface(graph, Collection.class);
    Vertex list = makeInterface(graph, List.class);
    
    // Classes
    Vertex obj = makeClass(graph, null, Object.class);
    Vertex abstrCollection = makeClass(graph, obj, AbstractCollection.class, collection);
    Vertex abstrList = makeClass(graph, abstrCollection, AbstractList.class, list);
    Vertex abstrSeqList = makeClass(graph, abstrList, AbstractSequentialList.class, list);
    makeClass(graph, abstrList, ArrayList.class, list);
    makeClass(graph, abstrSeqList, LinkedList.class, list, collection);
    
    return framedGraph;
}
 
Example #5
Source File: LinkedListMultimap.java    From codebuff with BSD 2-Clause "Simplified" License 6 votes vote down vote up
@Override
List<Entry<K, V>> createEntries() {
  @WeakOuter
  class EntriesImpl extends AbstractSequentialList<Entry<K, V>> {
    @Override
    public int size() {
      return size;
    }

    @Override
    public ListIterator<Entry<K, V>> listIterator(int index) {
      return new NodeIterator(index);
    }
  }
  return new EntriesImpl();
}
 
Example #6
Source File: LinkedListMultimap.java    From codebuff with BSD 2-Clause "Simplified" License 6 votes vote down vote up
/**
 * {@inheritDoc}
 *
 * <p>If the multimap is modified while an iteration over the list is in
 * progress (except through the iterator's own {@code add}, {@code set} or
 * {@code remove} operations) the results of the iteration are undefined.
 *
 * <p>The returned list is not serializable and does not have random access.
 */

@Override
public List<V> get(final @Nullable K key) {
  return new AbstractSequentialList<V>() {
    @Override
    public int size() {
      KeyList<K, V> keyList = keyToKeyList.get(key);
      return (keyList == null) ? 0 : keyList.count;
    }

    @Override
    public ListIterator<V> listIterator(int index) {
      return new ValueForKeyIterator(key, index);
    }
  };
}
 
Example #7
Source File: LinkedListMultimap.java    From codebuff with BSD 2-Clause "Simplified" License 6 votes vote down vote up
@Override
List<Entry<K, V>> createEntries() {
  @WeakOuter
  class EntriesImpl extends AbstractSequentialList<Entry<K, V>> {
    @Override
    public int size() {
      return size;
    }

    @Override
    public ListIterator<Entry<K, V>> listIterator(int index) {
      return new NodeIterator(index);
    }
  }
  return new EntriesImpl();
}
 
Example #8
Source File: LinkedListMultimap.java    From codebuff with BSD 2-Clause "Simplified" License 6 votes vote down vote up
/**
 * {@inheritDoc}
 *
 * <p>If the multimap is modified while an iteration over the list is in
 * progress (except through the iterator's own {@code add}, {@code set} or
 * {@code remove} operations) the results of the iteration are undefined.
 *
 * <p>The returned list is not serializable and does not have random access.
 */

@Override
public List<V> get(final @Nullable K key) {
  return new AbstractSequentialList<V>() {
    @Override
    public int size() {
      KeyList<K, V> keyList = keyToKeyList.get(key);
      return (keyList == null) ? 0 : keyList.count;
    }

    @Override
    public ListIterator<V> listIterator(int index) {
      return new ValueForKeyIterator(key, index);
    }
  };
}
 
Example #9
Source File: LinkedListMultimap.java    From codebuff with BSD 2-Clause "Simplified" License 6 votes vote down vote up
@Override
List<Entry<K, V>> createEntries() {
  @WeakOuter
  class EntriesImpl extends AbstractSequentialList<Entry<K, V>> {
    @Override
    public int size() {
      return size;
    }

    @Override
    public ListIterator<Entry<K, V>> listIterator(int index) {
      return new NodeIterator(index);
    }
  }
  return new EntriesImpl();
}
 
Example #10
Source File: LinkedListMultimap.java    From codebuff with BSD 2-Clause "Simplified" License 6 votes vote down vote up
/**
 * {@inheritDoc}
 *
 * <p>If the multimap is modified while an iteration over the list is in
 * progress (except through the iterator's own {@code add}, {@code set} or
 * {@code remove} operations) the results of the iteration are undefined.
 *
 * <p>The returned list is not serializable and does not have random access.
 */
@Override
public List<V> get(final @Nullable K key) {
  return new AbstractSequentialList<V>() {
    @Override
    public int size() {
      KeyList<K, V> keyList = keyToKeyList.get(key);
      return (keyList == null) ? 0 : keyList.count;
    }

    @Override
    public ListIterator<V> listIterator(int index) {
      return new ValueForKeyIterator(key, index);
    }
  };
}
 
Example #11
Source File: LinkedListMultimap.java    From codebuff with BSD 2-Clause "Simplified" License 6 votes vote down vote up
@Override
List<Entry<K, V>> createEntries() {
  @WeakOuter
  class EntriesImpl extends AbstractSequentialList<Entry<K, V>> {
    @Override
    public int size() {
      return size;
    }

    @Override
    public ListIterator<Entry<K, V>> listIterator(int index) {
      return new NodeIterator(index);
    }
  }
  return new EntriesImpl();
}
 
Example #12
Source File: LinkedListMultimap.java    From codebuff with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Override
List<V> createValues() {
  @WeakOuter
  class ValuesImpl extends AbstractSequentialList<V> {
    @Override
    public int size() {
      return size;
    }

    @Override
    public ListIterator<V> listIterator(int index) {
      final NodeIterator nodeItr = new NodeIterator(index);
      return new TransformedListIterator<Entry<K, V>, V>(nodeItr) {
        @Override
        V transform(Entry<K, V> entry) {
          return entry.getValue();
        }

        @Override
        public void set(V value) {
          nodeItr.setValue(value);
        }
      };
    }
  }
  return new ValuesImpl();
}
 
Example #13
Source File: IncidenceHandlerWithJavaClassVerticesTest.java    From Ferma with Apache License 2.0 5 votes vote down vote up
private Map<String, String> getAbstrListBothDirectionsExtEdges() {
    Map<String, String> edges = new HashMap<>();
    edges.put(AbstractList.class.getName(), AbstractCollection.class.getName());
    edges.put(ArrayList.class.getName(), AbstractList.class.getName());
    edges.put(AbstractSequentialList.class.getName(), AbstractList.class.getName());
    return edges;
}
 
Example #14
Source File: AbstractSequentialListTest.java    From j2objc with Apache License 2.0 5 votes vote down vote up
/**
 * {@link java.util.AbstractSequentialList#addAll(int, java.util.Collection)}
 */
public void test_addAll_ILCollection() {
    AbstractSequentialList<String> al = new ASLT<String>();
    String[] someList = { "Aardvark"  ,
                          "Bear"      ,
                          "Chimpanzee",
                          "Duck"      };
    Collection<String> c = Arrays.asList(someList);
    al.addAll(c);
    assertTrue("Should return true", al.addAll(2, c));
}
 
Example #15
Source File: BIRelatedConceptsITCase.java    From find with MIT License 5 votes vote down vote up
@SuppressWarnings("FeatureEnvy")
@Test
public void testResultsCountGoesDownAfterAddingConcept() {

    final ListView results = searchAndWait("loathing");

    final int resultsCountNoConcept = results.getTotalResultsNum();
    assumeThat("Initial query returned no results", resultsCountNoConcept, greaterThan(0));
    final AbstractSequentialList<Integer> resultCountList = new LinkedList<>();
    resultCountList.add(resultsCountNoConcept);

    final int numberOfRepeats = 2;
    for (int i = 0; i < numberOfRepeats; ++i) {
        final TopicMapView topicMap = goToTopicMap();
        topicMap.clickNthClusterHeading(0);
        Waits.loadOrFadeWait();

        findPage.goToListView();
        results.waitForResultsToLoad();

        resultCountList.add(results.getTotalResultsNum());
    }

    for (int i = 0; i < resultCountList.size() - 1; ++i) {
        LOGGER.info("Search no. " + (i + 1) + " yielded " + resultCountList.get(i) + " results.");
        assertThat("Adding a concept does not increase the result count",
                resultCountList.get(i),
                greaterThanOrEqualTo(resultCountList.get(i + 1)));
    }
}
 
Example #16
Source File: LinkedListMultimap.java    From codebuff with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Override
List<V> createValues() {
  @WeakOuter
  class ValuesImpl extends AbstractSequentialList<V> {
    @Override
    public int size() {
      return size;
    }

    @Override
    public ListIterator<V> listIterator(int index) {
      final NodeIterator nodeItr = new NodeIterator(index);
      return new TransformedListIterator<Entry<K, V>, V>(nodeItr) {
        @Override
        V transform(Entry<K, V> entry) {
          return entry.getValue();
        }

        @Override
        public void set(V value) {
          nodeItr.setValue(value);
        }
      };
    }
  }
  return new ValuesImpl();
}
 
Example #17
Source File: LinkedListMultimap.java    From codebuff with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Override
List<V> createValues() {
  @WeakOuter
  class ValuesImpl extends AbstractSequentialList<V> {
    @Override
    public int size() {
      return size;
    }

    @Override
    public ListIterator<V> listIterator(int index) {
      final NodeIterator nodeItr = new NodeIterator(index);
      return new TransformedListIterator<Entry<K, V>, V>(nodeItr) {
        @Override
        V transform(Entry<K, V> entry) {
          return entry.getValue();
        }

        @Override
        public void set(V value) {
          nodeItr.setValue(value);
        }
      };
    }
  }
  return new ValuesImpl();
}
 
Example #18
Source File: LinkedListMultimap.java    From codebuff with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Override
List<V> createValues() {
  @WeakOuter
  class ValuesImpl extends AbstractSequentialList<V> {
    @Override
    public int size() {
      return size;
    }

    @Override
    public ListIterator<V> listIterator(int index) {
      final NodeIterator nodeItr = new NodeIterator(index);
      return new TransformedListIterator<Entry<K, V>, V>(nodeItr) {
        @Override
        V transform(Entry<K, V> entry) {
          return entry.getValue();
        }

        @Override
        public void set(V value) {
          nodeItr.setValue(value);
        }
      };
    }
  }
  return new ValuesImpl();
}
 
Example #19
Source File: LinkedListMultimap.java    From codebuff with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Override
List<V> createValues() {
  @WeakOuter
  class ValuesImpl extends AbstractSequentialList<V> {
    @Override
    public int size() {
      return size;
    }

    @Override
    public ListIterator<V> listIterator(int index) {
      final NodeIterator nodeItr = new NodeIterator(index);
      return new TransformedListIterator<Entry<K, V>, V>(nodeItr) {
        @Override
        V transform(Entry<K, V> entry) {
          return entry.getValue();
        }

        @Override
        public void set(V value) {
          nodeItr.setValue(value);
        }
      };
    }
  }
  return new ValuesImpl();
}
 
Example #20
Source File: TextUtilsTest.java    From dhis2-core with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Test
public void testGetPrettyClassName()
{
    assertEquals( "Array List", TextUtils.getPrettyClassName( ArrayList.class ) );
    assertEquals( "Abstract Sequential List", TextUtils.getPrettyClassName( AbstractSequentialList.class ) );
}
 
Example #21
Source File: AbstractSequentialListJsonDeserializer.java    From domino-jackson with Apache License 2.0 4 votes vote down vote up
/** {@inheritDoc} */
@Override
protected AbstractSequentialList<T> newCollection() {
    return new LinkedList<T>();
}
 
Example #22
Source File: AbstractSequentialListRandomGeneratorTest.java    From openpojo with Apache License 2.0 4 votes vote down vote up
@Override
protected Class<? extends Collection> getExpectedTypeClass() {
  return AbstractSequentialList.class;
}
 
Example #23
Source File: AbstractSequentialListJsonDeserializer.java    From gwt-jackson with Apache License 2.0 4 votes vote down vote up
@Override
protected AbstractSequentialList<T> newCollection() {
    return new LinkedList<T>();
}