java.util

Interface List<E>

All Superinterfaces:
Collection<E>, Iterable<T>
Known Subinterfaces:
HandlerChain, IndexedRecord
Known Implementing Classes:
AbstractLinkedList, AbstractLinkedList.LinkedSubList, AbstractList<E>, AbstractListDecorator, AbstractSequentialList<E>, AbstractSerializableListDecorator, Anchor, ArrayList<E>, ArrayQueue<T>, ArrayStack, AttributeList, BucketingService.CollectedList, ByteListList, Chapter, ChapterAutoNumber, CharListList, CopyOnWriteArrayList<E>, CursorableLinkedList, CursorableLinkedList, DigesterRuleParser.PatternStack, DoubleListList, FastArrayList, FixedSizeList, FloatListList, GrowthList, IntListList, LazyDynaList, LazyList, LinkedList<E>, ListItem, LongListList, ManagedList, NodeCachingLinkedList, Paragraph, PersistentBag, PersistentIdentifierBag, PersistentList, Phrase, PredicatedList, RoleList, RoleUnresolvedList, Section, SetUniqueList, ShortListList, SnmpVarBindList, Stack<E>, SynchronizedList, TransformedList, TreeList, UnmodifiableList, Vector<E>, XfaForm.Stack2, XmpArray

public interface List<E>
extends Collection<E>

An ordered collection (also known as a sequence). The user of this interface has precise control over where in the list each element is inserted. The user can access elements by their integer index (position in the list), and search for elements in the list.

Unlike sets, lists typically allow duplicate elements. More formally, lists typically allow pairs of elements e1 and e2 such that e1.equals(e2), and they typically allow multiple null elements if they allow null elements at all. It is not inconceivable that someone might wish to implement a list that prohibits duplicates, by throwing runtime exceptions when the user attempts to insert them, but we expect this usage to be rare.

The List interface places additional stipulations, beyond those specified in the Collection interface, on the contracts of the iterator, add, remove, equals, and hashCode methods. Declarations for other inherited methods are also included here for convenience.

The List interface provides four methods for positional (indexed) access to list elements. Lists (like Java arrays) are zero based. Note that these operations may execute in time proportional to the index value for some implementations (the LinkedList class, for example). Thus, iterating over the elements in a list is typically preferable to indexing through it if the caller does not know the implementation.

The List interface provides a special iterator, called a ListIterator, that allows element insertion and replacement, and bidirectional access in addition to the normal operations that the Iterator interface provides. A method is provided to obtain a list iterator that starts at a specified position in the list.

The List interface provides two methods to search for a specified object. From a performance standpoint, these methods should be used with caution. In many implementations they will perform costly linear searches.

The List interface provides two methods to efficiently insert and remove multiple elements at an arbitrary point in the list.

Note: While it is permissible for lists to contain themselves as elements, extreme caution is advised: the equals and hashCode methods are no longer well defined on a such a list.

Some list implementations have restrictions on the elements that they may contain. For example, some implementations prohibit null elements, and some have restrictions on the types of their elements. Attempting to add an ineligible element throws an unchecked exception, typically NullPointerException or ClassCastException. Attempting to query the presence of an ineligible element may throw an exception, or it may simply return false; some implementations will exhibit the former behavior and some will exhibit the latter. More generally, attempting an operation on an ineligible element whose completion would not result in the insertion of an ineligible element into the list may throw an exception or it may succeed, at the option of the implementation. Such exceptions are marked as "optional" in the specification for this interface.

This interface is a member of the ../../../guide/collections/index.html"> Java Collections Framework.

Since:
1.2
See Also:
Collection, Set, ArrayList, LinkedList, Vector, Arrays.asList(Object[]), Collections.nCopies(int, Object), Collections.EMPTY_LIST, AbstractList, AbstractSequentialList

Method Summary

T[] toArray(T[] a)
Returns an array containing all of the elements in this list in proper sequence; the runtime type of the returned array is that of the specified array.
boolean
add(E o)
Appends the specified element to the end of this list (optional operation).
void
add(int index, E element)
Inserts the specified element at the specified position in this list (optional operation).
boolean
addAll(E> c)
Appends all of the elements in the specified collection to the end of this list, in the order that they are returned by the specified collection's iterator (optional operation).
boolean
addAll(int index, E> c)
Inserts all of the elements in the specified collection into this list at the specified position (optional operation).
void
clear()
Removes all of the elements from this list (optional operation).
boolean
contains(Object o)
Returns true if this list contains the specified element.
boolean
containsAll(Collection c)
Returns true if this list contains all of the elements of the specified collection.
boolean
equals(Object o)
Compares the specified object with this list for equality.
E
get(int index)
Returns the element at the specified position in this list.
int
hashCode()
Returns the hash code value for this list.
int
indexOf(Object o)
Returns the index in this list of the first occurrence of the specified element, or -1 if this list does not contain this element.
boolean
isEmpty()
Returns true if this list contains no elements.
Iterator
iterator()
Returns an iterator over the elements in this list in proper sequence.
int
lastIndexOf(Object o)
Returns the index in this list of the last occurrence of the specified element, or -1 if this list does not contain this element.
ListIterator
listIterator()
Returns a list iterator of the elements in this list (in proper sequence).
ListIterator
listIterator(int index)
Returns a list iterator of the elements in this list (in proper sequence), starting at the specified position in this list.
E
remove(int index)
Removes the element at the specified position in this list (optional operation).
boolean
remove(Object o)
Removes the first occurrence in this list of the specified element (optional operation).
boolean
removeAll(Collection c)
Removes from this list all the elements that are contained in the specified collection (optional operation).
boolean
retainAll(Collection c)
Retains only the elements in this list that are contained in the specified collection (optional operation).
E
set(int index, E element)
Replaces the element at the specified position in this list with the specified element (optional operation).
int
size()
Returns the number of elements in this list.
List
subList(int fromIndex, int toIndex)
Returns a view of the portion of this list between the specified fromIndex, inclusive, and toIndex, exclusive.
Object[]
toArray()
Returns an array containing all of the elements in this list in proper sequence.

Methods inherited from interface java.util.Collection<E>

T[] toArray, add, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, iterator, remove, removeAll, retainAll, size, toArray

Methods inherited from interface java.lang.Iterable<T>

iterator

Method Details

T[] toArray

public  T[] toArray(T[] a)
Returns an array containing all of the elements in this list in proper sequence; the runtime type of the returned array is that of the specified array. Obeys the general contract of the Collection.toArray(Object[]) method.
Specified by:
T[] toArray in interface Collection<E>
Parameters:
a - the array into which the elements of this list are to be stored, if it is big enough; otherwise, a new array of the same runtime type is allocated for this purpose.
Returns:
an array containing the elements of this list.
Throws:
ArrayStoreException - if the runtime type of the specified array is not a supertype of the runtime type of every element in this list.
NullPointerException - if the specified array is null.

add

public boolean add(E o)
Appends the specified element to the end of this list (optional operation).

Lists that support this operation may place limitations on what elements may be added to this list. In particular, some lists will refuse to add null elements, and others will impose restrictions on the type of elements that may be added. List classes should clearly specify in their documentation any restrictions on what elements may be added.

Specified by:
add in interface Collection<E>
Parameters:
o - element to be appended to this list.
Returns:
true (as per the general contract of the Collection.add method).
Throws:
UnsupportedOperationException - if the add method is not supported by this list.
ClassCastException - if the class of the specified element prevents it from being added to this list.
NullPointerException - if the specified element is null and this list does not support null elements.
IllegalArgumentException - if some aspect of this element prevents it from being added to this list.
Usages and Demos :

View More Examples of add(E o)
   1: 
   2:     private List list;
   3: 
   4:         ...
   5:     public UseThread8() {
   6:         list = new LinkedList();
   7:     }
   8:         ...
   9:                     synchronized (list) {
  10:                         list.add("" + i);
  11:                         try {

View Full Code Here
   1:     JTextArea txt=new JTextArea(20,40);
   2:     java.util.List m=new ArrayList();
   3:     
   4:         ...
   5:         for(int i=0;i<10;i++)
   6:         m.add("");
   7:         Collections.fill(m,"<--hello -->\n");
   8:         ...
   9:         cp.add(new JScrollPane(txt));
  10:         cp.add(b);
  11:         ...
  12:         cp.add(c);

View Full Code Here
   1: import java.util.GregorianCalendar;
   2: import java.util.List;
   3: 
   4:         ...
   5: 
   6:     protected List createReflectableObjects() {
   7:         ...
   8:         List list = new ArrayList();
   9: 
  10:         ...
  11:         list.add(new GregorianCalendar());
  12:         list.add(calendar);

View Full Code Here
   1: import java.util.HashMap;
   2: import java.util.List;
   3: import java.util.Map;
   4:         ...
   5: 
   6:     public List createInvalidDestinationClasses() throws Exception {
   7:         ...
   8:         List list = new ArrayList();
   9:         ...
  10:         list.add(Collection.class);

View Full Code Here
   1:         String[] allows= allowedPath.split(":");
   2:         List allowList=new ArrayList();
   3:         allowList.addAll(Arrays.asList(allows));
   4: 

View Full Code Here

add

public void add(int index,
                E element)
Inserts the specified element at the specified position in this list (optional operation). Shifts the element currently at that position (if any) and any subsequent elements to the right (adds one to their indices).
Parameters:
index - index at which the specified element is to be inserted.
element - element to be inserted.
Throws:
UnsupportedOperationException - if the add method is not supported by this list.
ClassCastException - if the class of the specified element prevents it from being added to this list.
NullPointerException - if the specified element is null and this list does not support null elements.
IllegalArgumentException - if some aspect of the specified element prevents it from being added to this list.
IndexOutOfBoundsException - if the index is out of range (index < 0 || index > size()).
Usages and Demos :

View More Examples of add(int index,E element)
   1: 
   2: import java.util.List;
   3: import java.util.LinkedList;
   4:         ...
   5:     public static void main(String[] args) {
   6:         List temp = new LinkedList();
   7:         long elapse = System.currentTimeMillis();
   8:         ...
   9:         for (int i = 0; i < 1000000; i++) {
  10:             temp.add(0, "");
  11:         }

View Full Code Here
   1: import java.util.ArrayList;
   2: import java.util.List;
   3: 
   4:         ...
   5:     public static final String ESCAPED_FUNCTION_NAME = "test";
   6:     public static final List ESCAPED_FUNCTION_PARAMS = new ArrayList();
   7:     static {
   8:         ...
   9:         ESCAPED_FUNCTION_PARAMS.add("12");
  10:         ESCAPED_FUNCTION_PARAMS.add("',\"'");
  11:     }
  12:         ...
  13:     public void testParseArguments() throws SQLException {
  14:         List parsedParams = FBEscapedFunctionHelper.parseArguments(ESCAPED_FUNCTION_CALL);

View Full Code Here
   1: 
   2:     protected List cells;
   3: 
   4:         ...
   5:             cells.remove(index);
   6:             cells.add(index, cell);
   7:         }
   8:         ...
   9:         else {
  10:             cells.add(-index-1, cell);
  11:         }

View Full Code Here
   1: package org.apache.commons.collections.list;
   2: 
   3:         ...
   4: import java.util.Collection;
   5: import java.util.List;
   6: 
   7:         ...
   8: 
   9:     public List makeEmptyList() {
  10:         return new GrowthList();
  11:         ...
  12:         assertEquals(0, grower.size());
  13:         grower.add(1, one);

View Full Code Here
   1: import java.util.Iterator;
   2: import java.util.List;
   3: import java.util.TreeMap;
   4:         ...
   5: 
   6:         List options = new ArrayList();
   7:         ...
   8:         List values = new ArrayList();
   9:         int selectedValue = -1;
  10:         ...
  11:         if (CmsStringUtil.isEmpty(currentTemplate)) {
  12:             options.add(0, "--- " + messages.key(Messages.GUI_PLEASE_SELECT_0) + " ---");

View Full Code Here

addAll

public boolean addAll(E> c)
Appends all of the elements in the specified collection to the end of this list, in the order that they are returned by the specified collection's iterator (optional operation). The behavior of this operation is unspecified if the specified collection is modified while the operation is in progress. (Note that this will occur if the specified collection is this list, and it's nonempty.)
Specified by:
addAll in interface Collection<E>
Parameters:
c - collection whose elements are to be added to this list.
Returns:
true if this list changed as a result of the call.
Throws:
UnsupportedOperationException - if the addAll method is not supported by this list.
ClassCastException - if the class of an element in the specified collection prevents it from being added to this list.
NullPointerException - if the specified collection contains one or more null elements and this list does not support null elements, or if the specified collection is null.
IllegalArgumentException - if some aspect of an element in the specified collection prevents it from being added to this list.
See Also:
add(Object)
Usages and Demos :

View More Examples of addAll(E> c)
   1: import java.util.ArrayList;
   2: import java.util.List;
   3: 
   4:         ...
   5: {
   6:    protected List list = new ArrayList();
   7: 
   8:         ...
   9:       if(lst instanceof JBossXSObjectList)
  10:          list.addAll(((JBossXSObjectList)lst).toList());
  11:       else

View Full Code Here
   1: 
   2:     public static List addRules( List result, Assembler a, Resource root )
   3:         {
   4:         ...
   5: 
   6:     static private void addIndirectRules( Assembler a, Resource root, List result )
   7:         {
   8:         ...
   9:             Resource r = getResource( it.nextStatement() );
  10:             result.addAll( ((RuleSet) a.open( r )).getRules() );
  11:             }
  12:         ...
  13:             Resource s = getResource( it.nextStatement() );
  14:             result.addAll( Rule.rulesFromURL( s.getURI() ) );

View Full Code Here
   1: import java.util.Iterator;
   2: import java.util.List;
   3: import java.util.ListIterator;
   4:         ...
   5: 
   6:   private List list = new ArrayList();
   7:   public void push(Object o) {
   8:         ...
   9:     if (o instanceof ConstrainingClause) {
  10:       list.addAll(((ConstrainingClause) o).list);
  11:     } else {

View Full Code Here
   1: import de.uniwue.ki.mas.basics.function.ICreateFunctionArgs;
   2: import de.uniwue.ki.mas.basics.function.list.FunctionDeclarationListFunctionsFactory;
   3: import de.uniwue.ki.mas.basics.functionCall.FunctionCallDeclarationFactory;
   4:         ...
   5:     SpecificListType(ISpecificType type) {
   6:         super("List", type);
   7: 
   8:         ...
   9: 
  10:     public static final List createNewList() {
  11:         return new ArrayList();
  12:         ...
  13:             if (anObject instanceof List)
  14:                 newList.addAll(((List) anObject));

View Full Code Here
   1: import java.util.Iterator;
   2: import java.util.List;
   3: 
   4:         ...
   5:     private final IWorkbenchSite fSite;
   6:     private final List fSelectedElements;
   7:     private final ISetSelectionTarget fSelectionTarget;
   8:         ...
   9:     private final List fListeners;
  10: 
  11:         ...
  12:             fSelectedElements.clear();
  13:             fSelectedElements.addAll(((IStructuredSelection)selection).toList());

View Full Code Here

addAll

public boolean addAll(int index,
                      E> c)
Inserts all of the elements in the specified collection into this list at the specified position (optional operation). Shifts the element currently at that position (if any) and any subsequent elements to the right (increases their indices). The new elements will appear in this list in the order that they are returned by the specified collection's iterator. The behavior of this operation is unspecified if the specified collection is modified while the operation is in progress. (Note that this will occur if the specified collection is this list, and it's nonempty.)
Parameters:
index - index at which to insert first element from the specified collection.
c - elements to be inserted into this list.
Returns:
true if this list changed as a result of the call.
Throws:
UnsupportedOperationException - if the addAll method is not supported by this list.
ClassCastException - if the class of one of elements of the specified collection prevents it from being added to this list.
NullPointerException - if the specified collection contains one or more null elements and this list does not support null elements, or if the specified collection is null.
IllegalArgumentException - if some aspect of one of elements of the specified collection prevents it from being added to this list.
IndexOutOfBoundsException - if the index is out of range (index < 0 || index > size()).
Usages and Demos :

View More Examples of addAll(int index,E> c)
   1: import java.util.Date;
   2: import java.util.List;
   3: 
   4:         ...
   5: 
   6:     protected List updateIssueStatus(TrackerManager trackerManager, com.jisuesoft.tracker.User user, com.jisuesoft.tracker.Issue issue, com.jisuesoft.tracker.State newState, String commentTitle, String commentDescription) {
   7:         return updateIssueStatus(trackerManager, user, issue, newState, null, null, null, commentTitle, commentDescription);
   8:         ...
   9: 
  10:     protected List updateIssueStatus(TrackerManager trackerManager, com.jisuesoft.tracker.User user, com.jisuesoft.tracker.Issue issue, com.jisuesoft.tracker.State newState, com.jisuesoft.tracker.User newOwner, Date dueDate, String commentTitle, String commentDescription) {
  11:         return updateIssueStatus(trackerManager, user, issue, newState, com.jisuesoft.tracker.Resolution.NONE, newOwner, dueDate, commentTitle, commentDescription);
  12:         ...
  13:         CommentChangeLogHolder ccholder = trackerManager.getCommentManager().createComment(commentTitle, commentDescription, user, issue);
  14:         changeLogs.addAll(0, ccholder.getChangeLogs());

View Full Code Here
   1: package org.apache.commons.collections15.list;
   2: 
   3:         ...
   4: import java.util.ArrayList;
   5: import java.util.List;
   6: 
   7:         ...
   8: 
   9:     protected List decorateList(List list, Predicate predicate) {
  10:         return PredicatedList.decorate(list, predicate);
  11:         ...
  12:         try {
  13:             list.addAll(0, elements);

View Full Code Here
   1: package org.apache.commons.collections15.list;
   2: 
   3:         ...
   4: import java.util.Iterator;
   5: import java.util.List;
   6: 
   7:         ...
   8: 
   9:     public List makeEmptyList() {
  10:         return UnmodifiableList.decorate(new ArrayList());
  11:         ...
  12:         try {
  13:             list.addAll(0, array);

View Full Code Here
   1:     private static final long UPDATE_DELAY = 200;
   2:     private final List fRequests;
   3: 
   4:         ...
   5: 
   6:     private synchronized void addRequests(List list) {
   7:         ...
   8:         fRequests.addAll(0, list);
   9:     }

View Full Code Here
   1: package org.apache.commons.collections.list;
   2: 
   3:         ...
   4: import java.util.ArrayList;
   5: import java.util.List;
   6: 
   7:         ...
   8:     
   9:     protected List decorateList(List list, Predicate predicate) {
  10:         return PredicatedList.decorate(list, predicate);
  11:         ...
  12:         try {
  13:             list.addAll(0,elements);

View Full Code Here

clear

public void clear()
Removes all of the elements from this list (optional operation). This list will be empty after this call returns (unless it throws an exception).
Specified by:
clear in interface Collection<E>
Throws:
UnsupportedOperationException - if the clear method is not supported by this list.
Usages and Demos :

View More Examples of clear()
   1: import java.util.ArrayList;
   2: import java.util.List;
   3: 
   4:         ...
   5:     public static void main(String[] args) {
   6:         List list = (List) Proxy.newInstance(ArrayList.class);
   7:         list.add("test");
   8:         ...
   9:         String test = (String) list.get(0);
  10:         list.clear();
  11:     }

View Full Code Here
   1: import java.util.ArrayList;
   2: import java.util.List;
   3: 
   4:         ...
   5: class ErrorNotifier implements Runnable {
   6:     private final List myErrors = new ArrayList();
   7:     private final UIFacadeImpl myUIFacade;
   8:         ...
   9:         myUIFacade.showErrorDialog(buf.toString());
  10:         myErrors.clear();
  11:         myUIFacade.resetErrorLog();

View Full Code Here
   1: package de.uniwue.ki.mas.basics.function.list;
   2:         ...
   3: import java.util.List;
   4: 
   5:         ...
   6:     public void act(IExecuteFunctionArgs executeFunctionArgs) throws SimulationRuntimeException {
   7:         List list = (List) _functionList.execute(executeFunctionArgs);
   8: 
   9:         ...
  10: 
  11:         list.clear();

View Full Code Here
   1: import java.util.ArrayList;
   2: import java.util.List;
   3: 
   4:         ...
   5:   private final String name;
   6:   private final List preList;
   7:         ...
   8:   private final List postList;
   9: 
  10:         ...
  11:   public void zeroCounts() {
  12:     preList.clear();

View Full Code Here
   1: {
   2:     List data;
   3: 
   4:         ...
   5: 
   6:     public JMeterJListModel(List data)
   7:     {
   8:         ...
   9: 
  10:     public void setData(List data)
  11:     {
  12:         ...
  13:         this.data.clear();

View Full Code Here

contains

public boolean contains(Object o)
Returns true if this list contains the specified element. More formally, returns true if and only if this list contains at least one element e such that (o==null ? e==null : o.equals(e)).
Specified by:
contains in interface Collection<E>
Parameters:
o - element whose presence in this list is to be tested.
Returns:
true if this list contains the specified element.
Throws:
ClassCastException - if the type of the specified element is incompatible with this list (optional).
NullPointerException - if the specified element is null and this list does not support null elements (optional).
Usages and Demos :

View More Examples of contains(Object o)
   1: 
   2: import java.util.List;
   3: 
   4:         ...
   5: public class ListContentProvider implements IStructuredContentProvider {
   6:     List fContents;    
   7: 
   8:         ...
   9:     public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
  10:         if (newInput instanceof List) 
  11:             fContents= (List)newInput;
  12:         ...
  13:     public boolean isDeleted(Object o) {
  14:         return fContents != null && !fContents.contains(o);

View Full Code Here
   1: import java.util.Iterator;
   2: import java.util.List;
   3: 
   4:         ...
   5: 
   6:         List list = config.getList("list");
   7:         assertNotNull("list not found", config.getProperty("list"));
   8:         ...
   9:         assertEquals("list size", 2, list.size());
  10:         assertTrue("'value1' is not in the list", list.contains("value1"));
  11:         ...
  12:         assertTrue("'value2' is not in the list", list.contains("value2"));

View Full Code Here
   1: import java.util.Iterator;
   2: import java.util.List;
   3: 
   4:         ...
   5:         Feature f1 = createTestFeature(a1);
   6:         List list = area.listActivities();
   7: 
   8:         ...
   9:         assertTrue("Invalid number of elements in the list", list.size() == 2);
  10:         assertTrue("Expected feature not in list", list.contains(f1));
  11:         ...
  12:         assertTrue("Expected feature not in list", list.contains(f2));

View Full Code Here
   1: import java.util.ArrayList;
   2: import java.util.List;
   3: 
   4:         ...
   5:   final CtuluModelDoubleArray coteEau_;
   6:   List listener_;
   7:   final CtuluModelDoubleArray u_;
   8:         ...
   9:   public boolean containsListener(final H2dSIListener _listener){
  10:     return listener_ != null && listener_.contains(_listener);
  11:   }
  12:         ...
  13: 
  14:   public List getVariables(){

View Full Code Here
   1: import java.util.HashMap;
   2: import java.util.List;
   3: import java.util.Map;
   4:         ...
   5:   EfGridInterface grid_;
   6:   List listener_;
   7:   DicoEntite nbSeuilKw_;
   8:         ...
   9: 
  10:   protected void createSeuil(List initList){
  11:     if (seuils_ == null)
  12:         ...
  13:   public boolean containsListener(H2dTelemacSeuilListener _l){
  14:     return listener_ != null && listener_.contains(_l);

View Full Code Here

containsAll

public boolean containsAll(Collection c)
Returns true if this list contains all of the elements of the specified collection.
Specified by:
containsAll in interface Collection<E>
Parameters:
c - collection to be checked for containment in this list.
Returns:
true if this list contains all of the elements of the specified collection.
Throws:
ClassCastException - if the types of one or more elements in the specified collection are incompatible with this list (optional).
NullPointerException - if the specified collection contains one or more null elements and this list does not support null elements (optional).
NullPointerException - if the specified collection is null.
Usages and Demos :

View More Examples of containsAll(Collection c)
   1:   };
   2:   static List a = Arrays.toList(s);
   3:         ...
   4:   static List a2 = Arrays.toList(
   5:     new String[] { s[3], s[4], s[5] });
   6:         ...
   7:     System.out.println(
   8:       "a.containsAll(a2) = " + 
   9:         ...
  10:       a.containsAll(a2));

View Full Code Here
   1: 
   2: public abstract class RefreshableList implements Refreshable, List {
   3: 
   4:         ...
   5:     public boolean containsAll(Collection arg0) {
   6:         return backingList.containsAll(arg0);
   7:     }
   8:         ...
   9:     }
  10:     public List subList(int arg0, int arg1) {
  11:         return backingList.subList(arg0, arg1);
  12:         ...
  13:     }
  14:     protected List backingList;

View Full Code Here
   1: 
   2: public class QueryList implements List {
   3:         ...
   4:   private List list;
   5: 
   6:         ...
   7:   public boolean containsAll(Collection collection) {
   8:     return list.containsAll(collection);
   9:   }

View Full Code Here
   1: 
   2: public class UniqueList implements List {
   3:         ...
   4:     private List list;
   5: 
   6:         ...
   7:     public boolean containsAll(Collection c) {
   8:         return list.containsAll(c);
   9:     }

View Full Code Here
   1: 
   2: public class ListAdapter extends AbstractAdapter implements java.util.List, MappedObject, Serializable {
   3:         ...
   4:     transient private List datalist;
   5: 
   6:         ...
   7:     super.readObject(in);
   8:     datalist=(List)in.readObject();
   9:     }
  10:         ...
  11:     public boolean containsAll(Collection c) {
  12:     return datalist.containsAll(c);

View Full Code Here

equals

public boolean equals(Object o)
Compares the specified object with this list for equality. Returns true if and only if the specified object is also a list, both lists have the same size, and all corresponding pairs of elements in the two lists are equal. (Two elements e1 and e2 are equal if (e1==null ? e2==null : e1.equals(e2)).) In other words, two lists are defined to be equal if they contain the same elements in the same order. This definition ensures that the equals method works properly across different implementations of the List interface.
Specified by:
equals in interface Collection<E>
Overrides:
equals in interface Object
Parameters:
o - the object to be compared for equality with this list.
Returns:
true if the specified object is equal to this list.
Usages and Demos :

View More Examples of equals(Object o)
   1: import java.util.ArrayList;
   2: import java.util.List;
   3: 
   4:         ...
   5: 
   6:     private List list = new ArrayList();
   7: 
   8:         ...
   9:     public boolean isEqual(Object other) {
  10:         return list.equals(other);
  11:     }

View Full Code Here
   1: import java.util.Arrays;
   2: import java.util.List;
   3: 
   4:         ...
   5: {
   6:    private List values;
   7: 
   8:         ...
   9:       JavaType other = (JavaType)obj;
  10:       return values != null && values.equals(other.values) || values == null && other.values == null;
  11:    }

View Full Code Here
   1: import java.util.AbstractList;
   2: import java.util.List;
   3: 
   4:         ...
   5: {
   6:     private List _inner;
   7:     private boolean _shutdown;
   8:         ...
   9:     {
  10:         return _inner.equals(o);
  11:     }
  12:         ...
  13: 
  14:     public void setInner(List list)

View Full Code Here
   1: import java.util.Iterator;
   2: import java.util.List;
   3: 
   4:         ...
   5: 
   6:     protected List _values;
   7: 
   8:         ...
   9:         else {
  10:             return _values.equals(((Tuple)other)._values);
  11:         }        

View Full Code Here
   1: 
   2: public class QueryList implements List {
   3:         ...
   4:   private List list;
   5: 
   6:         ...
   7:   public boolean equals(Object o) {
   8:     return list.equals(o);
   9:   }

View Full Code Here

get

public E get(int index)
Returns the element at the specified position in this list.
Parameters:
index - index of element to return.
Returns:
the element at the specified position in this list.
Throws:
IndexOutOfBoundsException - if the index is out of range (index < 0 || index >= size()).
Usages and Demos :

View More Examples of get(int index)
   1: 
   2: import java.util.List;
   3: 
   4:         ...
   5: 
   6:     private final List rowNames;
   7: 
   8:         ...
   9:     private final List columnNames;
  10: 
  11:         ...
  12:     {
  13:         return rowNames != null ? (Comparable) rowNames.get(row) : super

View Full Code Here
   1: 
   2: import java.util.List;
   3: import java.util.LinkedList;
   4:         ...
   5:     public static final ELContext getCurrent() {
   6:         final List jcs = (List)_elCtxs.get();
   7:         ...
   8:         return jcs != null && !jcs.isEmpty() ? (ELContext)jcs.get(0): null;
   9:     }

View Full Code Here
   1: import java.util.Iterator;
   2: import java.util.List;
   3: import java.util.Set;
   4:         ...
   5: 
   6:   public boolean hasValue(int index) { return values != null && values.get(index) != null; }
   7:         ...
   8:   public double getValue(int index) { return ((Double)values.get(index)).doubleValue(); }
   9: 
  10:         ...
  11:   {
  12:     GenomicProperty prop = genericProperties != null ? (GenomicProperty)genericProperties.get(key) : null;

View Full Code Here
   1: import java.util.ArrayList;
   2: import java.util.List;
   3: import java.io.File;
   4:         ...
   5: 
   6:     String[] existingSubdirs = dir.list();
   7:     assertTrue("checking existence of subdirectories", existingSubdirs.length == 0);
   8:         ...
   9:     String rawList = "a;b c;d:e;f;";
  10:     List list = Modifier.stringToArrayList(rawList);
  11:     assertEquals("checking size of array list", 4, list.size());
  12:         ...
  13: 
  14:     assertEquals("checking array list", "a", list.get(0));

View Full Code Here
   1:         assertNotNull("array not found", array);
   2:         ObjectAssert.assertInstanceOf("the array element is not parsed as a List", List.class, array);
   3:         ...
   4:         List list = config.getList("array");
   5: 
   6:         ...
   7:         assertEquals("size", 3, list.size());
   8:         assertEquals("1st element", "value1", list.get(0));
   9:         ...
  10:         assertEquals("2nd element", "value2", list.get(1));

View Full Code Here

hashCode

public int hashCode()
Returns the hash code value for this list. The hash code of a list is defined to be the result of the following calculation:
  hashCode = 1;
  Iterator i = list.iterator();
  while (i.hasNext()) {
      Object obj = i.next();
      hashCode = 31*hashCode + (obj==null ? 0 : obj.hashCode());
  }
 
This ensures that list1.equals(list2) implies that list1.hashCode()==list2.hashCode() for any two lists, list1 and list2, as required by the general contract of Object.hashCode.
Specified by:
hashCode in interface Collection<E>
Overrides:
hashCode in interface Object
Returns:
the hash code value for this list.
Usages and Demos :

View More Examples of hashCode()
   1: 
   2: import java.util.List;
   3: import java.util.ArrayList;
   4:         ...
   5: public class EntityListAdapterBase implements EntityListAdapter{
   6:     private final List _list;
   7: 
   8:         ...
   9: 
  10:     public EntityListAdapterBase(List list){
  11:         if(list == null)
  12:         ...
  13:     public int hashCode() {
  14:         return _list.hashCode();

View Full Code Here
   1: import java.util.AbstractList;
   2: import java.util.List;
   3: 
   4:         ...
   5: {
   6:     private List _inner;
   7:     private boolean _shutdown;
   8:         ...
   9:     {
  10:         return _inner.hashCode();
  11:     }
  12:         ...
  13: 
  14:     public void setInner(List list)

View Full Code Here
   1: import java.util.Arrays;
   2: import java.util.List;
   3: 
   4:         ...
   5:     private final String name;
   6:     private final List parameterTypes;
   7: 
   8:         ...
   9:         int result;
  10:         result = name.hashCode();
  11:         ...
  12:         result = 29 * result + parameterTypes.hashCode();

View Full Code Here
   1: 
   2: import java.util.List;
   3: import java.util.Properties;
   4:         ...
   5:   private final Properties properties;
   6:   private final List args;
   7: 
   8:         ...
   9:   public NodeInfo(final RemoteHost appServer, final String nodeName, final String hostName,
  10:                   final Properties properties, final List args) {
  11:     this.appServer = appServer;
  12:         ...
  13:     int result;
  14:     result = appServer.hashCode();

View Full Code Here
   1: import java.io.IOException;
   2: import java.util.List;
   3: import java.util.ArrayList;
   4:         ...
   5: {
   6:     private List columns;
   7: 
   8:         ...
   9: 
  10:     public void setColumns(List columns)
  11:     {
  12:         ...
  13:     {
  14:         int result=super.hashCode();

View Full Code Here

indexOf

public int indexOf(Object o)
Returns the index in this list of the first occurrence of the specified element, or -1 if this list does not contain this element. More formally, returns the lowest index i such that (o==null ? get(i)==null : o.equals(get(i))), or -1 if there is no such index.
Parameters:
o - element to search for.
Returns:
the index in this list of the first occurrence of the specified element, or -1 if this list does not contain this element.
Throws:
ClassCastException - if the type of the specified element is incompatible with this list (optional).
NullPointerException - if the specified element is null and this list does not support null elements (optional).
Usages and Demos :

View More Examples of indexOf(Object o)
   1: package net.betterjava.collection.performance.list;
   2: 
   3:         ...
   4: import java.util.List;
   5: import java.util.Collection;
   6:         ...
   7: 
   8:     protected long runTestBody(int rpts, List innerList) {
   9:         Collection c = Collections.nCopies(rpts, "");
  10:         ...
  11:         for (int j = 0; j < rpts; j++) {
  12:             innerList.indexOf("index");

View Full Code Here
   1: 
   2: import java.util.List;
   3: import org.w3c.dom.CharacterData;
   4:         ...
   5:         if (getParent() != null) {
   6:             List list = getParent().getChildren();
   7:         ...
   8:             list.add(list.indexOf(this) + 1, vtx);
   9:         }

View Full Code Here
   1:     {
   2:         return children!=null ? children.indexOf(node) : -1;
   3:     }
   4:         ...
   5:     
   6:     public List getChildren()
   7:     {
   8:         ...
   9: 
  10:     public void setChildren(List children)
  11:     {

View Full Code Here
   1: 
   2: import java.util.List;
   3: import java.util.ArrayList;
   4:         ...
   5: {
   6:     private List children_;
   7:     private EventBroadcaster nodeBroadcaster_;
   8:         ...
   9:     {
  10:         return children_.indexOf(child);
  11:     }

View Full Code Here
   1:     {
   2:         return children!=null ? children.indexOf(node) : -1;
   3:     }
   4:         ...
   5: 
   6:     public List getChildren()
   7:     {
   8:         ...
   9: 
  10:     public void setChildren(List children)
  11:     {

View Full Code Here

isEmpty

public boolean isEmpty()
Returns true if this list contains no elements.
Specified by:
isEmpty in interface Collection<E>
Returns:
true if this list contains no elements.
Usages and Demos :

View More Examples of isEmpty()
   1:   };
   2:   static List a = Arrays.toList(s);
   3:         ...
   4:   static List a2 = Arrays.toList(
   5:     new String[] { s[3], s[4], s[5] });
   6:         ...
   7:       a.containsAll(a2));
   8:     System.out.println("a.isEmpty() = " +
   9:         ...
  10:       a.isEmpty());

View Full Code Here
   1:     
   2:     private List runnables = new ArrayList();
   3: 
   4:         ...
   5:     public boolean isEmpty() {
   6:         return runnables.isEmpty();
   7:     }
   8: 
   9:     public boolean remove(IRunnableWithProgress runnable) {

View Full Code Here
   1: import java.util.Iterator;
   2: import java.util.List;
   3: 
   4:         ...
   5:     private static final long serialVersionUID = 999535944385968291L;
   6:     private List list = new ArrayList();
   7: 
   8:         ...
   9:     public boolean isEmpty() {
  10:         return list.isEmpty();
  11:     }

View Full Code Here
   1: 
   2:     protected List events;
   3: 
   4:         ...
   5:     {
   6:         List tmp = SCollection.createArrayList();
   7:         for(int i=0; i<events.size(); i++)
   8:         ...
   9:     {
  10:         return events.isEmpty();
  11:     }

View Full Code Here
   1: 
   2: public abstract class RefreshableList implements Refreshable, List {
   3: 
   4:         ...
   5:     public boolean isEmpty() {
   6:         return backingList.isEmpty();
   7:     }
   8:         ...
   9:     }
  10:     public List subList(int arg0, int arg1) {
  11:         return backingList.subList(arg0, arg1);
  12:         ...
  13:     }
  14:     protected List backingList;

View Full Code Here

iterator

public Iterator iterator()
Returns an iterator over the elements in this list in proper sequence.
Specified by:
iterator in interface Collection<E>
iterator in interface Iterable<T>
Returns:
an iterator over the elements in this list in proper sequence.
Usages and Demos :

View More Examples of iterator()
   1: import java.util.Iterator;
   2: import java.util.List;
   3: 
   4:         ...
   5: {
   6:     protected Iterator dispatchOrder( List invokablesList ) {
   7:         ...
   8:         return invokablesList.iterator();
   9:     }

View Full Code Here
   1: import java.util.Iterator;
   2: import java.util.List;
   3: 
   4:         ...
   5:     public FeatureTextWriterRegistry() {}
   6:     private List featureTextWriters = new ArrayList();
   7:     public void register(AbstractFeatureTextWriter featureTextWriter) {
   8:         ...
   9:     public Iterator iterator() {
  10:         return featureTextWriters.iterator();
  11:     }

View Full Code Here
   1: import java.util.Iterator;
   2: import java.util.List;
   3: 
   4:         ...
   5:     {
   6:         List list = new ArrayList();
   7:         for (int j = 0; j < 5; j++)
   8:         ...
   9:         }
  10:         return list.iterator();
  11:     }

View Full Code Here
   1: import java.util.Iterator;
   2: import java.util.List;
   3: 
   4:         ...
   5: 
   6:     private List childrenList;
   7:     
   8:         ...
   9:     {
  10:         return childrenList.iterator();
  11:     }

View Full Code Here
   1: import java.util.Iterator;
   2: import java.util.List;
   3: 
   4:         ...
   5:     {
   6:         List list = new ArrayList();
   7:         list.add(new NumberedItem(1));
   8:         ...
   9:         list.add(new NumberedItem(3));
  10:         return list.iterator();
  11:     }

View Full Code Here

lastIndexOf

public int lastIndexOf(Object o)
Returns the index in this list of the last occurrence of the specified element, or -1 if this list does not contain this element. More formally, returns the highest index i such that (o==null ? get(i)==null : o.equals(get(i))), or -1 if there is no such index.
Parameters:
o - element to search for.
Returns:
the index in this list of the last occurrence of the specified element, or -1 if this list does not contain this element.
Throws:
ClassCastException - if the type of the specified element is incompatible with this list (optional).
NullPointerException - if the specified element is null and this list does not support null elements (optional).
Usages and Demos :

View More Examples of lastIndexOf(Object o)
   1: 
   2: public abstract class RefreshableList implements Refreshable, List {
   3: 
   4:         ...
   5:     public int lastIndexOf(Object arg0) {
   6:         return backingList.lastIndexOf(arg0);
   7:     }
   8:         ...
   9:     }
  10:     public List subList(int arg0, int arg1) {
  11:         return backingList.subList(arg0, arg1);
  12:         ...
  13:     }
  14:     protected List backingList;

View Full Code Here
   1: 
   2: public class QueryList implements List {
   3:         ...
   4:   private List list;
   5: 
   6:         ...
   7:   public int lastIndexOf(Object o) {
   8:     return list.lastIndexOf(o);
   9:   }

View Full Code Here
   1: 
   2: public class UniqueList implements List {
   3:         ...
   4:     private List list;
   5: 
   6:         ...
   7:     public int lastIndexOf(Object o) {
   8:         return list.lastIndexOf(o);
   9:     }

View Full Code Here
   1: 
   2: public class ListAdapter extends AbstractAdapter implements java.util.List, MappedObject, Serializable {
   3:         ...
   4:     transient private List datalist;
   5: 
   6:         ...
   7:     super.readObject(in);
   8:     datalist=(List)in.readObject();
   9:     }
  10:         ...
  11:     public int lastIndexOf(Object elem) {
  12:     return datalist.lastIndexOf(toPersistentObject(elem));

View Full Code Here
   1: import java.util.Iterator;
   2: import java.util.List;
   3: import java.util.ListIterator;
   4:         ...
   5: 
   6: public class ImmutableFirstElementList implements List {
   7: 
   8:         ...
   9:     private List list = new ArrayList();
  10:     
  11:         ...
  12:     public int lastIndexOf(Object o) {
  13:         return list.lastIndexOf(o);

View Full Code Here

listIterator

public ListIterator listIterator()
Returns a list iterator of the elements in this list (in proper sequence).
Returns:
a list iterator of the elements in this list (in proper sequence).
Usages and Demos :

View More Examples of listIterator()
   1: 
   2:     List list = new ArrayList();
   3: 
   4:         ...
   5:   {
   6:       if ( !list.contains( listener ) )
   7:           list.add( listener );
   8:         ...
   9:   {
  10:       ListIterator iter = list.listIterator();
  11:       while( iter.hasNext() ) 

View Full Code Here
   1:     
   2:     List a = new ArrayList();
   3:     Collection1.fill(a);
   4:         ...
   5:     a = Collections.unmodifiableList(a);
   6:     ListIterator lit = a.listIterator();
   7: 
   8:     Set s = new HashSet();
   9:     Collection1.fill(s);

View Full Code Here
   1: import java.util.Iterator;
   2: import java.util.List;
   3: import java.util.ListIterator;
   4:         ...
   5: 
   6:     public ReverseListIterator(List list) {
   7:         ...
   8:         m_iter = list.listIterator();
   9:         while ( m_iter.hasNext() ) { m_iter.next(); }    

View Full Code Here
   1:   private File input;
   2:   List listenerList = new Vector();
   3: 
   4:         ...
   5: 
   6:     ListIterator iterator = listenerList.listIterator();
   7:     while (iterator.hasNext()) {
   8:       DigestListener dl = (DigestListener) iterator.next();
   9:       dl.digestCalculated(digest);

View Full Code Here
   1: import org.w3c.dom.Element;
   2: import java.util.List;
   3: import org.mmbase.util.logging.Logger;
   4:         ...
   5: 
   6:     public List filter(List urlcomposers) {
   7:         ...
   8:         ListIterator i = urlcomposers.listIterator();
   9:         while (i.hasNext()) {

View Full Code Here

listIterator

public ListIterator listIterator(int index)
Returns a list iterator of the elements in this list (in proper sequence), starting at the specified position in this list. The specified index indicates the first element that would be returned by an initial call to the next method. An initial call to the previous method would return the element with the specified index minus one.
Parameters:
index - index of first element to be returned from the list iterator (by a call to the next method).
Returns:
a list iterator of the elements in this list (in proper sequence), starting at the specified position in this list.
Throws:
IndexOutOfBoundsException - if the index is out of range (index < 0 || index > size()).
Usages and Demos :

View More Examples of listIterator(int index)
   1:     }
   2:     abstract void test(List a);
   3:   }
   4:         ...
   5:     new Tester("get", 300) { 
   6:       void test(List a) {
   7:         for(int i = 0; i < REPS; i++) {
   8:         ...
   9:     new Tester("iteration", 300) { 
  10:       void test(List a) {
  11:         for(int i = 0; i < REPS; i++) {
  12:         ...
  13:         String s = "test";
  14:         ListIterator it = a.listIterator(half);

View Full Code Here
   1: 
   2: public abstract class RefreshableList implements Refreshable, List {
   3: 
   4:         ...
   5:     public ListIterator listIterator(int arg0) {
   6:         return backingList.listIterator(arg0);
   7:     }
   8:         ...
   9:     }
  10:     public List subList(int arg0, int arg1) {
  11:         return backingList.subList(arg0, arg1);
  12:         ...
  13:     }
  14:     protected List backingList;

View Full Code Here
   1: 
   2: import java.util.List;
   3: import java.util.ListIterator;
   4:         ...
   5: 
   6:         List entries = feed.getEntries();
   7: 
   8:         ...
   9:         ListIterator listIterator = entries.listIterator(0);
  10:         NewsItem[] newsItems = new NewsItem[entries.size()];

View Full Code Here
   1: 
   2: public class QueryList implements List {
   3:         ...
   4:   private List list;
   5: 
   6:         ...
   7:   public ListIterator listIterator(int i) {
   8:     return list.listIterator(i);
   9:   }

View Full Code Here
   1: import java.util.Collection;
   2: import java.util.List;
   3: import java.util.ListIterator;
   4:         ...
   5: 
   6: public class UnmodifiableList extends UnmodifiableCollection implements List
   7: {
   8:         ...
   9: 
  10:     public UnmodifiableList(List l)
  11:     {
  12:         ...
  13:         List l = getList();
  14:         ListIterator i = l.listIterator(index);

View Full Code Here

remove

public E remove(int index)
Removes the element at the specified position in this list (optional operation). Shifts any subsequent elements to the left (subtracts one from their indices). Returns the element that was removed from the list.
Parameters:
index - the index of the element to removed.
Returns:
the element previously at the specified position.
Throws:
UnsupportedOperationException - if the remove method is not supported by this list.
IndexOutOfBoundsException - if the index is out of range (index < 0 || index >= size()).
Usages and Demos :

View More Examples of remove(int index)
   1:   public static void main (String args[]) {
   2:     List list = Arrays.asList(args);
   3:         ...
   4:     list.remove("Hi");
   5:         ...
   6:     System.out.println(list);
   7:   }

View Full Code Here
   1:                      "One", "Two", "Three"};
   2:     List list1 = new ArrayList(Arrays.asList(init));
   3:         ...
   4:     List list2 = new ArrayList(Arrays.asList(init));
   5:         ...
   6:     list1.remove("One");
   7:     System.out.println(list1);

View Full Code Here
   1: public class List1 {
   2:   public static List fill(List a) {
   3:     Collections2.countries.reset();
   4:         ...
   5:   static ListIterator lit;
   6:   public static void zakladniTest(List a) {
   7:     a.addAll(fill(new ArrayList()));
   8:     a.addAll(3, fill(new ArrayList())); 
   9:     b = a.containsAll(fill(new ArrayList()));

View Full Code Here
   1: public class List1 {
   2:   public static List fill(List a) {
   3:         ...
   4:     return (List)Collection1.fill(a);
   5:   }
   6:   public static void print(List a) {
   7:     for(int i = 0; i < a.size(); i++)

View Full Code Here
   1:     declare warning: Pointcuts.anyCollectionWriteCalls() : "anyCollectionWriteCalls";
   2:     public static void main(String[] list) {
   3:     }
   4:         ...
   5:         
   6:         List list = new ArrayList();
   7:         
   8:         
   9:         

View Full Code Here

remove

public boolean remove(Object o)
Removes the first occurrence in this list of the specified element (optional operation). If this list does not contain the element, it is unchanged. More formally, removes the element with the lowest index i such that (o==null ? get(i)==null : o.equals(get(i))) (if such an element exists).
Specified by:
remove in interface Collection<E>
Parameters:
o - element to be removed from this list, if present.
Returns:
true if this list contained the specified element.
Throws:
ClassCastException - if the type of the specified element is incompatible with this list (optional).
NullPointerException - if the specified element is null and this list does not support null elements (optional).
UnsupportedOperationException - if the remove method is not supported by this list.
Usages and Demos :

View More Examples of remove(Object o)
   1:   public static void main (String args[]) {
   2:     List list = Arrays.asList(args);
   3:         ...
   4:     list.remove("Hi");
   5:         ...
   6:     System.out.println(list);
   7:   }

View Full Code Here
   1:                      "One", "Two", "Three"};
   2:     List list1 = new ArrayList(Arrays.asList(init));
   3:         ...
   4:     List list2 = new ArrayList(Arrays.asList(init));
   5:         ...
   6:     list1.remove("One");
   7:     System.out.println(list1);

View Full Code Here
   1: public class List1 {
   2:   public static List fill(List a) {
   3:     Collections2.countries.reset();
   4:         ...
   5:   static ListIterator lit;
   6:   public static void zakladniTest(List a) {
   7:     a.addAll(fill(new ArrayList()));
   8:     a.addAll(3, fill(new ArrayList())); 
   9:     b = a.containsAll(fill(new ArrayList()));

View Full Code Here
   1: public class List1 {
   2:   public static List fill(List a) {
   3:         ...
   4:     return (List)Collection1.fill(a);
   5:   }
   6:   public static void print(List a) {
   7:     for(int i = 0; i < a.size(); i++)

View Full Code Here
   1:     declare warning: Pointcuts.anyCollectionWriteCalls() : "anyCollectionWriteCalls";
   2:     public static void main(String[] list) {
   3:     }
   4:         ...
   5:         
   6:         List list = new ArrayList();
   7:         
   8:         
   9:         

View Full Code Here

removeAll

public boolean removeAll(Collection c)
Removes from this list all the elements that are contained in the specified collection (optional operation).
Specified by:
removeAll in interface Collection<E>
Parameters:
c - collection that defines which elements will be removed from this list.
Returns:
true if this list changed as a result of the call.
Throws:
UnsupportedOperationException - if the removeAll method is not supported by this list.
ClassCastException - if the types of one or more elements in this list are incompatible with the specified collection (optional).
NullPointerException - if this list contains one or more null elements and the specified collection does not support null elements (optional).
NullPointerException - if the specified collection is null.
Usages and Demos :

View More Examples of removeAll(Collection c)
   1:   };
   2:   static List a = Arrays.toList(s);
   3:         ...
   4:   static List a2 = Arrays.toList(
   5:     new String[] { s[3], s[4], s[5] });
   6:   public static void main(String[] args) {
   7:     System.out.println(

View Full Code Here
   1: import java.util.ArrayList;
   2: import java.util.List;
   3: 
   4:         ...
   5:                 else if( InstallOptionsModel.PROPERTY_FLAGS.equals(id)) {
   6:                     List flags = new ArrayList((List)propertySource.getPropertyValue(id));
   7:         ...
   8:                     flags.removeAll(SCROLL_FLAGS);
   9:                     return flags;

View Full Code Here
   1: package org.apache.commons.collections15.list;
   2: 
   3:         ...
   4: import java.util.Iterator;
   5: import java.util.List;
   6: 
   7:         ...
   8: 
   9:     public List makeEmptyList() {
  10:         return UnmodifiableList.decorate(new ArrayList());
  11:         ...
  12:         try {
  13:             list.removeAll(array);

View Full Code Here
   1: package org.apache.commons.collections.list;
   2: 
   3:         ...
   4: import java.util.Iterator;
   5: import java.util.List;
   6: 
   7:         ...
   8: 
   9:     public List makeEmptyList() {
  10:         return UnmodifiableList.decorate(new ArrayList());
  11:         ...
  12:         try {
  13:             list.removeAll(array);

View Full Code Here
   1: 
   2:     protected List returnList;
   3:     protected Iterator iterator;
   4:         ...
   5: 
   6:     protected List getList() throws JspTagException {
   7:         throw new JspTagException("Should use 'referid' attribute on liststrings tag");
   8:         ...
   9:             }
  10:             if (o instanceof List) {
  11:                 returnList = (List) o;
  12:         ...
  13:                 if (removeObject instanceof Collection) {
  14:                     returnList.removeAll((Collection) removeObject);

View Full Code Here

retainAll

public boolean retainAll(Collection c)
Retains only the elements in this list that are contained in the specified collection (optional operation). In other words, removes from this list all the elements that are not contained in the specified collection.
Specified by:
retainAll in interface Collection<E>
Parameters:
c - collection that defines which elements this set will retain.
Returns:
true if this list changed as a result of the call.
Throws:
UnsupportedOperationException - if the retainAll method is not supported by this list.
ClassCastException - if the types of one or more elements in this list are incompatible with the specified collection (optional).
NullPointerException - if this list contains one or more null elements and the specified collection does not support null elements (optional).
NullPointerException - if the specified collection is null.
Usages and Demos :

View More Examples of retainAll(Collection c)
   1:   };
   2:   static List a = Arrays.toList(s);
   3:         ...
   4:   static List a2 = Arrays.toList(
   5:     new String[] { s[3], s[4], s[5] });
   6:   public static void main(String[] args) {
   7:     System.out.println(

View Full Code Here
   1: 
   2: public abstract class RefreshableList implements Refreshable, List {
   3: 
   4:         ...
   5:     public boolean retainAll(Collection arg0) {
   6:         return backingList.retainAll(arg0);
   7:     }
   8:         ...
   9:     }
  10:     public List subList(int arg0, int arg1) {
  11:         return backingList.subList(arg0, arg1);
  12:         ...
  13:     }
  14:     protected List backingList;

View Full Code Here
   1: 
   2: public class QueryList implements List {
   3:         ...
   4:   private List list;
   5: 
   6:         ...
   7:   public boolean retainAll(Collection collection) {
   8:     return list.retainAll(collection);
   9:   }

View Full Code Here
   1: import java.util.LinkedList;
   2: import java.util.List;
   3: import java.util.Set;
   4:         ...
   5: {
   6:     List principals = new LinkedList();
   7:     Set set = new HashSet();
   8:         ...
   9:     {
  10:         set.retainAll(c);
  11:         ...
  12:         return principals.retainAll(c);

View Full Code Here
   1: 
   2: public class UniqueList implements List {
   3:         ...
   4:     private List list;
   5: 
   6:         ...
   7:     public boolean retainAll(Collection c) {
   8:         return list.retainAll(c);
   9:     }

View Full Code Here

set

public E set(int index,
             E element)
Replaces the element at the specified position in this list with the specified element (optional operation).
Parameters:
index - index of element to replace.
element - element to be stored at the specified position.
Returns:
the element previously at the specified position.
Throws:
UnsupportedOperationException - if the set method is not supported by this list.
ClassCastException - if the class of the specified element prevents it from being added to this list.
NullPointerException - if the specified element is null and this list does not support null elements.
IllegalArgumentException - if some aspect of the specified element prevents it from being added to this list.
IndexOutOfBoundsException - if the index is out of range (index < 0 || index >= size()).
Usages and Demos :

View More Examples of set(int index,E element)
   1: package org.apache.commons.collections15.list;
   2: 
   3:         ...
   4:     public Collection makeConfirmedFullCollection() {
   5:         List list = new ArrayList();
   6:         list.addAll(Arrays.asList(getFullElements()));
   7:         ...
   8: 
   9:         list.set(0, "22");
  10:         assertEquals(new Integer(22), list.get(0));

View Full Code Here
   1: import java.util.ArrayList;
   2: import java.util.List;
   3: 
   4:         ...
   5: 
   6:         public List route(EdgeView edge) {
   7:             if (edge.isLoop()) {
   8:         ...
   9: 
  10:         protected List routeLoop(EdgeView edge) {
  11:             List newPoints = new ArrayList();
  12:         ...
  13:             if (edge.getSource() instanceof PortView) {
  14:                 newPoints.set(0, edge.getSource());

View Full Code Here
   1: package org.apache.commons.collections.list;
   2: 
   3:         ...
   4: import java.util.Collection;
   5: import java.util.List;
   6: 
   7:         ...
   8: 
   9:     public List makeEmptyList() {
  10:         return new GrowthList();
  11:         ...
  12:         assertEquals(0, grower.size());
  13:         grower.set(1, one);

View Full Code Here
   1: package org.apache.commons.collections.list;
   2: 
   3:         ...
   4: import java.util.Collection;
   5: import java.util.List;
   6: import java.util.ListIterator;
   7:         ...
   8:     public Collection makeConfirmedFullCollection() {
   9:         List list = new ArrayList();
  10:         list.addAll(Arrays.asList(getFullElements()));
  11:         ...
  12:         
  13:         list.set(0, "22");

View Full Code Here
   1: package org.apache.commons.collections15.list;
   2: 
   3:         ...
   4: 
   5: import java.util.List;
   6: 
   7:         ...
   8: 
   9:     public static void benchmark(List l) {
  10:         StringBuffer sb = new StringBuffer();
  11:         ...
  12: 
  13:         l.set(1, "0");

View Full Code Here

size

public int size()
Returns the number of elements in this list. If this list contains more than Integer.MAX_VALUE elements, returns Integer.MAX_VALUE.
Specified by:
size in interface Collection<E>
Returns:
the number of elements in this list.
Usages and Demos :

View More Examples of size()
   1: import java.util.Collection;
   2: import java.util.List;
   3: 
   4:         ...
   5:     private IMember fMember;
   6:     private List fCallLocations;
   7: 
   8:         ...
   9:     public boolean hasCallLocations() {
  10:         return fCallLocations != null && fCallLocations.size() > 0;
  11:     }

View Full Code Here
   1: import java.util.Iterator;
   2: import java.util.List;
   3: 
   4:         ...
   5:     private String name;
   6:     private List values;
   7:     private boolean readOnly;
   8:         ...
   9:     
  10:     public List getValueList()
  11:     {
  12:         ...
  13:     {
  14:         return values != null && values.size() > 0;

View Full Code Here
   1: import java.util.Collections;
   2: import java.util.List;
   3: import java.util.Map;
   4:         ...
   5:     private final Gui4jAccessImpl mGui4jAccessImpl;
   6:     private final List mDependantProperties;
   7:     private final Map mValueClassMap;
   8:         ...
   9: 
  10:     Gui4jDefaultCall(Gui4jComponent gui4jComponent, Gui4jAccessImpl gui4jAccessImpl, List dependantProperties,
  11:             Map valueClassMap)
  12:         ...
  13:     {
  14:         return mDependantProperties != null && mDependantProperties.size() > 0;

View Full Code Here
   1:     {
   2:         return children!=null ? children.size() : 0;
   3:     }
   4:         ...
   5:                         int    index;
   6:                         for(index=0; index<children.size() && FILENODE_COMPARATOR.compare(children.get(index), child)<=0; index++);
   7:                         children.add(index, child);
   8:         ...
   9:     
  10:     public List getChildren()
  11:     {
  12:         ...
  13: 
  14:     public void setChildren(List children)

View Full Code Here
   1: 
   2: import java.util.List;
   3: 
   4:         ...
   5:                         "VALUES ('KL020','2006-01-31 10:05:00', 'RTM', '2006-01-31 12:25:00', 'OSL', 'BUSINESS', 90, 10)");
   6:         List<Flight> flights = flightDao.findFlights("RTM", "OSL", interval, ServiceClass.BUSINESS);
   7:         assertNotNull("Invalid result", flights);
   8:         ...
   9:         assertEquals("Invalid amount of flights", 1, flights.size());
  10:     }
  11:         ...
  12:         DateTime dateTime = new DateTime(2006, 6, 1, 0, 0, 0, 0);
  13:         List flights = flightDao.findFlights("RTM", "OSL", new Interval(dateTime, dateTime), ServiceClass.BUSINESS);

View Full Code Here

subList

public List subList(int fromIndex,
                       int toIndex)
Returns a view of the portion of this list between the specified fromIndex, inclusive, and toIndex, exclusive. (If fromIndex and toIndex are equal, the returned list is empty.) The returned list is backed by this list, so non-structural changes in the returned list are reflected in this list, and vice-versa. The returned list supports all of the optional list operations supported by this list.

This method eliminates the need for explicit range operations (of the sort that commonly exist for arrays). Any operation that expects a list can be used as a range operation by passing a subList view instead of a whole list. For example, the following idiom removes a range of elements from a list:

	    list.subList(from, to).clear();
 
Similar idioms may be constructed for indexOf and lastIndexOf, and all of the algorithms in the Collections class can be applied to a subList.

The semantics of the list returned by this method become undefined if the backing list (i.e., this list) is structurally modified in any way other than via the returned list. (Structural modifications are those that change the size of this list, or otherwise perturb it in such a fashion that iterations in progress may yield incorrect results.)

Parameters:
fromIndex - low endpoint (inclusive) of the subList.
toIndex - high endpoint (exclusive) of the subList.
Returns:
a view of the specified range within this list.
Throws:
IndexOutOfBoundsException - for an illegal endpoint index value (fromIndex < 0 || toIndex > size || fromIndex > toIndex).
Usages and Demos :

View More Examples of subList(int fromIndex,int toIndex)
   1: import java.util.LinkedHashSet;
   2: import java.util.List;
   3: import java.util.Map;
   4:         ...
   5: 
   6:   static synchronized List cachedTestElements()
   7:   {
   8:         ...
   9: 
  10:   static synchronized List cachedTestElements(int size)
  11:   {
  12:         ...
  13:       if (l.size() > size)
  14:         return l.subList(0, size);

View Full Code Here
   1: import java.util.Iterator;
   2: import java.util.List;
   3: import java.util.ListIterator;
   4:         ...
   5: 
   6: public class ImmutableFirstElementList implements List {
   7: 
   8:         ...
   9:     private List list = new ArrayList();
  10:     
  11:         ...
  12:     public boolean remove(Object o) {
  13:         return list.subList(1, list.size()).remove(o);

View Full Code Here
   1: 
   2:   public List getFlatPosts() {
   3:     return Rssify.rssify(getPosts(10));
   4:         ...
   5: 
   6:   public List getPosts(int count) {
   7:     Calendar startC = new GregorianCalendar();
   8:         ...
   9: 
  10:     List posts = new ArrayList();
  11:     if (posts.size() < count) {
  12:         ...
  13:       List oldPosts = space.getByDate(blog.getName(), Month.toKey(startC), Month.toKey(endC));
  14:       oldPosts = oldPosts.subList(0, Math.min(oldPosts.size(), count - posts.size()));

View Full Code Here
   1: import java.util.Iterator;
   2: import java.util.List;
   3: 
   4:         ...
   5:   protected LogRecordFilter _filter = new PassingLogRecordFilter();
   6:   protected List _allRecords = new ArrayList();
   7:         ...
   8:   protected List _filteredRecords;
   9:   protected int _maxNumberOfLogRecords = 5000;
  10:         ...
  11:         List oldRecords =
  12:             _allRecords.subList(0, trim);

View Full Code Here
   1: import java.util.Iterator;
   2: import java.util.List;
   3: import java.util.Map;
   4:         ...
   5: 
   6:     protected List attributeMappings;
   7: 
   8:         ...
   9:     protected List createColumns(final FeatureSchema schema) {
  10:         ArrayList columns = new ArrayList();
  11:         ...
  12:     protected List nonDefaultAttributeMappings() {
  13:         return attributeMappings.subList(1, attributeMappings.size());

View Full Code Here

toArray

public Object[] toArray()
Returns an array containing all of the elements in this list in proper sequence. Obeys the general contract of the Collection.toArray method.
Specified by:
toArray in interface Collection<E>
Returns:
an array containing all of the elements in this list in proper sequence.
See Also:
Arrays.asList(Object[])
Usages and Demos :

View More Examples of toArray()
   1: import java.util.ArrayList;
   2: import java.util.List;
   3: 
   4:         ...
   5:   public Object[] create() {
   6:     List result = new ArrayList();
   7:     for (int i = 0; i < 10; i++) {
   8:         ...
   9:     
  10:     return result.toArray();
  11:   }

View Full Code Here
   1: import java.util.ArrayList;
   2: import java.util.List;
   3: 
   4:         ...
   5: public class AbstractsModel {
   6:     List _abstracts;
   7:     AbstractsModelListener _listener;
   8:         ...
   9:     public Object[] getElements() {
  10:         return _abstracts.toArray();
  11:     }

View Full Code Here
   1: import java.util.ArrayList;
   2: import java.util.List;
   3: 
   4:         ...
   5:     private final Structural structural; 
   6:     private List children;
   7:     
   8:         ...
   9:     public Object[] children() {
  10:         return children.toArray();
  11:     }

View Full Code Here
   1: 
   2: import java.util.List;
   3: 
   4:         ...
   5: public class ListContentProvider implements IStructuredContentProvider {
   6:     List fContents;    
   7: 
   8:         ...
   9:         if (fContents != null && fContents == input)
  10:             return fContents.toArray();
  11:         return new Object[0];
  12:         ...
  13:     public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
  14:         if (newInput instanceof List) 

View Full Code Here
   1: import java.util.Arrays;
   2: import java.util.List;
   3: 
   4:         ...
   5: {
   6:     private List choices;
   7: 
   8:         ...
   9:     {
  10:         return choices.toArray();
  11:     }

View Full Code Here