Package java.util

Examples of java.util.AbstractSequentialList


    /**
     * @tests java.util.AbstractSequentialList#get(int)
     */
    public void test_get() {
        AbstractSequentialList list = new MyAbstractSequentialList();
        list.add(1);
        list.add("value");
        assertEquals(1, list.get(0));
        assertEquals("value", list.get(1));

        // get value by index which is out of bounds
        try {
            list.get(list.size());
            fail("Should throw IndexOutOfBoundsException.");
        } catch (IndexOutOfBoundsException e) {
            // expected
        }
        try {
            list.get(-1);
            fail("Should throw IndexOutOfBoundsException.");
        } catch (IndexOutOfBoundsException e) {
            // expected
        }

View Full Code Here


    /**
     * @tests java.util.AbstractSequentialList#remove(int)
     */
    public void test_remove() {
        AbstractSequentialList list = new MyAbstractSequentialList();
        list.add(1);

        // normal test
        assertEquals(1, list.remove(0));

        list.add("value");
        assertEquals("value", list.remove(0));

        // remove index is out of bounds
        try {
            list.remove(list.size());
            fail("Should throw IndexOutOfBoundsException.");
        } catch (IndexOutOfBoundsException e) {
            // expected
        }
        try {
            list.remove(-1);
            fail("Should throw IndexOutOfBoundsException.");
        } catch (IndexOutOfBoundsException e) {
            // expected
        }

        // list dont't support remove operation
        try {
            AbstractSequentialList mylist = new MockAbstractSequentialList();
            mylist.remove(0);
            fail("Should throw UnsupportedOperationException.");
        } catch (UnsupportedOperationException e) {
            // expected
        }
    }
View Full Code Here

    this.keyToKeyTail.clear();
  }

  public List get(final Object paramObject)
  {
    return new AbstractSequentialList()
    {
      public int size()
      {
        return LinkedListMultimap.this.keyCount.count(paramObject);
      }
View Full Code Here

  public List values()
  {
    Object localObject = this.valuesList;
    if (localObject == null)
      this.valuesList = (localObject = new AbstractSequentialList()
      {
        public int size()
        {
          return LinkedListMultimap.this.keyCount.size();
        }
View Full Code Here

  public List entries()
  {
    Object localObject = this.entries;
    if (localObject == null)
      this.entries = (localObject = new AbstractSequentialList()
      {
        public int size()
        {
          return LinkedListMultimap.this.keyCount.size();
        }
View Full Code Here

TOP

Related Classes of java.util.AbstractSequentialList

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.