72 * methods are no longer well defined on such a list. 73 * 74 * <p>Some list implementations have restrictions on the elements that 75 * they may contain. For example, some implementations prohibit null elements, 76 * and some have restrictions on the types of their elements. Attempting to 77 * add an ineligible element throws an unchecked exception, typically 78 * <tt>NullPointerException</tt> or <tt>ClassCastException</tt>. Attempting 79 * to query the presence of an ineligible element may throw an exception, 80 * or it may simply return false; some implementations will exhibit the former 81 * behavior and some will exhibit the latter. More generally, attempting an 82 * operation on an ineligible element whose completion would not result in 83 * the insertion of an ineligible element into the list may throw an 84 * exception or it may succeed, at the option of the implementation. 85 * Such exceptions are marked as "optional" in the specification for this 86 * interface. 87 * 88 * <p>This interface is a member of the 89 * <a href="{@docRoot}/../technotes/guides/collections/index.html"> 90 * Java Collections Framework</a>. 91 * 92 * @author Josh Bloch 93 * @author Neal Gafter 94 * @see Collection 95 * @see Set 96 * @see ArrayList 97 * @see LinkedList 98 * @see Vector 99 * @see Arrays#asList(Object[]) 100 * @see Collections#nCopies(int, Object) 101 * @see Collections#EMPTY_LIST 102 * @see AbstractList 103 * @see AbstractSequentialList 104 * @since 1.2 105 */ 106 107 public interface List<E> extends Collection<E> { 108 // Query Operations 109 110 /** 111 * Returns the number of elements in this list. If this list contains | 72 * methods are no longer well defined on such a list. 73 * 74 * <p>Some list implementations have restrictions on the elements that 75 * they may contain. For example, some implementations prohibit null elements, 76 * and some have restrictions on the types of their elements. Attempting to 77 * add an ineligible element throws an unchecked exception, typically 78 * <tt>NullPointerException</tt> or <tt>ClassCastException</tt>. Attempting 79 * to query the presence of an ineligible element may throw an exception, 80 * or it may simply return false; some implementations will exhibit the former 81 * behavior and some will exhibit the latter. More generally, attempting an 82 * operation on an ineligible element whose completion would not result in 83 * the insertion of an ineligible element into the list may throw an 84 * exception or it may succeed, at the option of the implementation. 85 * Such exceptions are marked as "optional" in the specification for this 86 * interface. 87 * 88 * <p>This interface is a member of the 89 * <a href="{@docRoot}/../technotes/guides/collections/index.html"> 90 * Java Collections Framework</a>. 91 * 92 * @param <E> the type of elements in this list 93 * 94 * @author Josh Bloch 95 * @author Neal Gafter 96 * @see Collection 97 * @see Set 98 * @see ArrayList 99 * @see LinkedList 100 * @see Vector 101 * @see Arrays#asList(Object[]) 102 * @see Collections#nCopies(int, Object) 103 * @see Collections#EMPTY_LIST 104 * @see AbstractList 105 * @see AbstractSequentialList 106 * @since 1.2 107 */ 108 109 public interface List<E> extends Collection<E> { 110 // Query Operations 111 112 /** 113 * Returns the number of elements in this list. If this list contains |