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


Java AbstractSequentialList类代码示例

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


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

示例1: createValues

import java.util.AbstractSequentialList; //导入依赖的package包/类
@Override
List<V> createValues() {
  return new 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);
        }
      };
    }
  };
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:24,代码来源:LinkedListMultimap.java

示例2: get

import java.util.AbstractSequentialList; //导入依赖的package包/类
/**
 * {@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);
    }
  };
}
 
开发者ID:zugzug90,项目名称:guava-mock,代码行数:25,代码来源:LinkedListMultimap.java

示例3: createEntries

import java.util.AbstractSequentialList; //导入依赖的package包/类
@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);
    }

    @Override
    public void forEach(Consumer<? super Entry<K, V>> action) {
      checkNotNull(action);
      for (Node<K, V> node = head; node != null; node = node.next) {
        action.accept(node);
      }
    }
  }
  return new EntriesImpl();
}
 
开发者ID:zugzug90,项目名称:guava-mock,代码行数:25,代码来源:LinkedListMultimap.java

示例4: get

import java.util.AbstractSequentialList; //导入依赖的package包/类
/**
 * {@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);
    }
  };
}
 
开发者ID:antlr,项目名称:codebuff,代码行数:26,代码来源:LinkedListMultimap.java

示例5: createEntries

import java.util.AbstractSequentialList; //导入依赖的package包/类
@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();
}
 
开发者ID:antlr,项目名称:codebuff,代码行数:17,代码来源:LinkedListMultimap.java

示例6: entries

import java.util.AbstractSequentialList; //导入依赖的package包/类
/**
 * {@inheritDoc}
 *
 * <p>The iterator generated by the returned collection traverses the entries
 * in the order they were added to the multimap. Because the entries may have
 * duplicates and follow the insertion ordering, this method returns a {@link
 * List}, instead of the {@link Collection} specified in the {@link
 * ListMultimap} interface.
 *
 * <p>An entry's {@link Entry#getKey} method always returns the same key,
 * regardless of what happens subsequently. As long as the corresponding
 * key-value mapping is not removed from the multimap, {@link Entry#getValue}
 * returns the value from the multimap, which may change over time, and {@link
 * Entry#setValue} modifies that value. Removing the mapping from the
 * multimap does not alter the value returned by {@code getValue()}, though a
 * subsequent {@code setValue()} call won't update the multimap but will lead
 * to a revised value being returned by {@code getValue()}.
 */
@Override
public List<Entry<K, V>> entries() {
  List<Entry<K, V>> result = entries;
  if (result == null) {
    @WeakOuter
    class LinkedListMultimapEntries extends AbstractSequentialList<Entry<K, V>> {
      @Override public int size() {
        return size;
      }

      @Override public ListIterator<Entry<K, V>> listIterator(int index) {
        return new TransformedListIterator<Node<K, V>, Entry<K, V>>(new NodeIterator(index)) {
          @Override
          Entry<K, V> transform(Node<K, V> node) {
            return createEntry(node);
          }
        };
      }
    }
    entries = result = new LinkedListMultimapEntries();
  }
  return result;
}
 
开发者ID:Sellegit,项目名称:j2objc,代码行数:42,代码来源:LinkedListMultimap.java

示例7: testsForAbstractSequentialList

import java.util.AbstractSequentialList; //导入依赖的package包/类
public Test testsForAbstractSequentialList() {
  return ListTestSuiteBuilder
      .using(new TestStringListGenerator () {
          @Override protected List<String> create(final String[] elements) {
            // For this test we trust ArrayList works
            final List<String> list = new ArrayList<String>();
            Collections.addAll(list, elements);
            return new AbstractSequentialList<String>() {
              @Override public int size() {
                return list.size();
              }
              @Override public ListIterator<String> listIterator(int index) {
                return list.listIterator(index);
              }
            };
          }
        })
      .named("AbstractSequentialList")
      .withFeatures(
          ListFeature.GENERAL_PURPOSE,
          CollectionFeature.ALLOWS_NULL_VALUES,
          CollectionSize.ANY)
      .suppressing(suppressForAbstractSequentialList())
      .createTestSuite();
}
 
开发者ID:sander120786,项目名称:guava-libraries,代码行数:26,代码来源:TestsForListsInJavaUtil.java

示例8: test_addAll_ILCollection

import java.util.AbstractSequentialList; //导入依赖的package包/类
/**
 * @tests {@link java.util.AbstractSequentialList#addAll(int, java.util.Collection)}
 */
@TestTargetNew(
    level = TestLevel.PARTIAL_COMPLETE,
    notes = "Doesn't verify all exceptions according to the specification.",
    method = "addAll",
    args = {int.class, java.util.Collection.class}
)
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));
}
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:20,代码来源:AbstractSequentialListTest.java

示例9: entries

import java.util.AbstractSequentialList; //导入依赖的package包/类
/**
 * {@inheritDoc}
 *
 * <p>The iterator generated by the returned collection traverses the entries
 * in the order they were added to the multimap. Because the entries may have
 * duplicates and follow the insertion ordering, this method returns a {@link
 * List}, instead of the {@link Collection} specified in the {@link
 * ListMultimap} interface.
 *
 * <p>An entry's {@link Entry#getKey} method always returns the same key,
 * regardless of what happens subsequently. As long as the corresponding
 * key-value mapping is not removed from the multimap, {@link Entry#getValue}
 * returns the value from the multimap, which may change over time, and {@link
 * Entry#setValue} modifies that value. Removing the mapping from the
 * multimap does not alter the value returned by {@code getValue()}, though a
 * subsequent {@code setValue()} call won't update the multimap but will lead
 * to a revised value being returned by {@code getValue()}.
 */
@Override
public List<Entry<K, V>> entries() {
  List<Entry<K, V>> result = entries;
  if (result == null) {
    entries = result = new AbstractSequentialList<Entry<K, V>>() {
      @Override public int size() {
        return keyCount.size();
      }

      @Override public ListIterator<Entry<K, V>> listIterator(int index) {
        return new TransformedListIterator<Node<K, V>, Entry<K, V>>(new NodeIterator(index)) {
          @Override
          Entry<K, V> transform(Node<K, V> node) {
            return createEntry(node);
          }
        };
      }
    };
  }
  return result;
}
 
开发者ID:10xEngineer,项目名称:My-Wallet-Android,代码行数:40,代码来源:LinkedListMultimap.java

示例10: get

import java.util.AbstractSequentialList; //导入依赖的package包/类
/**
 * {@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 @NullableDecl 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);
    }
  };
}
 
开发者ID:google,项目名称:guava,代码行数:25,代码来源:LinkedListMultimap.java

示例11: load

import java.util.AbstractSequentialList; //导入依赖的package包/类
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;
}
 
开发者ID:Syncleus,项目名称:Ferma,代码行数:19,代码来源:JavaGraphLoader.java

示例12: getCollectionTypes

import java.util.AbstractSequentialList; //导入依赖的package包/类
private Collection<Class<? extends Collection>> getCollectionTypes() {
    Collection<Class<? extends Collection>> result = new HashSet<>();

    result.add(List.class);
    result.add(NavigableSet.class);
    result.add(Set.class);
    result.add(SortedSet.class);
    result.add(AbstractCollection.class);
    result.add(AbstractList.class);
    result.add(AbstractSequentialList.class);
    result.add(AbstractSet.class);
    result.add(ArrayList.class);
    result.add(ConcurrentSkipListSet.class);
    result.add(CopyOnWriteArrayList.class);
    result.add(CopyOnWriteArraySet.class);
    //result.add(EnumSet.class); // Specialized collection excluded in test
    result.add(HashSet.class);
    result.add(LinkedHashSet.class);
    result.add(LinkedList.class);
    result.add(Stack.class);
    result.add(TreeSet.class);
    result.add(Vector.class);

    return result;
}
 
开发者ID:erchu,项目名称:bean-cp,代码行数:26,代码来源:CollectionConvertersTest.java

示例13: basicList

import java.util.AbstractSequentialList; //导入依赖的package包/类
public List<E> basicList()
{
  return
    new AbstractSequentialList<E>()
    {
      @Override
      public ListIterator<E> listIterator(int index)
      {
        return basicListIterator(index);
      }

      @Override
      public int size()
      {
        return AbstractSequentialInternalEList.this.size();
      }
    };
}
 
开发者ID:LangleyStudios,项目名称:eclipse-avro,代码行数:19,代码来源:AbstractSequentialInternalEList.java

示例14: testIterator

import java.util.AbstractSequentialList; //导入依赖的package包/类
public Result testIterator() {
    final Object elems[] = { "0", new Integer(25), "aaa",
            "string with spaces", new Object(),
            new MyAbstractSequentialList(), };

    AbstractSequentialList l = new MyAbstractSequentialList();
    Iterator i = l.iterator();
    for (int j = 0; j < elems.length; j++) {
        l.add(j, elems[j]);
    }

    int k = 0;
    while (i.hasNext()) {
        if (!i.next().equals(elems[k++])) {
            return failed("next returns wrong value: index=" + k
                    + "element=" + elems[k]);
        }
    }

    return passed();

}
 
开发者ID:freeVM,项目名称:freeVM,代码行数:23,代码来源:AbstractSequentialListTest.java

示例15: basicList

import java.util.AbstractSequentialList; //导入依赖的package包/类
public List<E> basicList()
{
  return
    new AbstractSequentialList<E>()
    {
      private static final long serialVersionUID = 1L;

      @Override
      public ListIterator<E> listIterator(int index)
      {
        return basicListIterator(index);
      }

      @Override
      public int size()
      {
        return AbstractSequentialInternalEList.this.size();
      }
    };
}
 
开发者ID:markus1978,项目名称:clickwatch,代码行数:21,代码来源:AbstractSequentialInternalEList.java


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