1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210
|
/*
* Copyright (C) 2002-2014 Sebastiano Vigna
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package PACKAGE;
import java.util.List;
#if ! #keyclass(Reference)
/** A type-specific {@link List}; provides some additional methods that use polymorphism to avoid (un)boxing.
*
* <P>Note that this type-specific interface extends {@link Comparable}: it is expected that implementing
* classes perform a lexicographical comparison using the standard operator "less then" for primitive types,
* and the usual {@link Comparable#compareTo(Object) compareTo()} method for objects.
*
* <P>Additionally, this interface strengthens {@link #listIterator()},
* {@link #listIterator(int)} and {@link #subList(int,int)}.
*
* <P>Besides polymorphic methods, this interfaces specifies methods to copy into an array or remove contiguous
* sublists. Although the abstract implementation of this interface provides simple, one-by-one implementations
* of these methods, it is expected that concrete implementation override them with optimized versions.
*
* @see List
*/
public interface LIST KEY_GENERIC extends List<KEY_GENERIC_CLASS>, Comparable<List<? extends KEY_GENERIC_CLASS>>, COLLECTION KEY_GENERIC {
#else
/** A type-specific {@link List}; provides some additional methods that use polymorphism to avoid (un)boxing.
*
* <P>Additionally, this interface strengthens {@link #iterator()}, {@link #listIterator()},
* {@link #listIterator(int)} and {@link #subList(int,int)}. The former had been already
* strengthened upstream, but unfortunately {@link List} re-specifies it.
*
* <P>Besides polymorphic methods, this interfaces specifies methods to copy into an array or remove contiguous
* sublists. Although the abstract implementation of this interface provides simple, one-by-one implementations
* of these methods, it is expected that concrete implementation override them with optimized versions.
*
* @see List
*/
public interface LIST KEY_GENERIC extends List<KEY_GENERIC_CLASS>, COLLECTION KEY_GENERIC {
#endif
/** Returns a type-specific iterator on the elements of this list (in proper sequence).
*
* Note that this specification strengthens the one given in {@link List#iterator()}.
* It would not be normally necessary, but {@link java.lang.Iterable#iterator()} is bizarrily re-specified
* in {@link List}.
*
* @return an iterator on the elements of this list (in proper sequence).
*/
KEY_LIST_ITERATOR KEY_GENERIC iterator();
/** Returns a type-specific list iterator on the list.
*
* @see #listIterator()
* @deprecated As of <code>fastutil</code> 5, replaced by {@link #listIterator()}.
*/
@Deprecated
KEY_LIST_ITERATOR KEY_GENERIC KEY_LIST_ITERATOR_METHOD();
/** Returns a type-specific list iterator on the list starting at a given index.
*
* @see #listIterator(int)
* @deprecated As of <code>fastutil</code> 5, replaced by {@link #listIterator(int)}.
*/
@Deprecated
KEY_LIST_ITERATOR KEY_GENERIC KEY_LIST_ITERATOR_METHOD( int index );
/** Returns a type-specific list iterator on the list.
*
* @see List#listIterator()
*/
KEY_LIST_ITERATOR KEY_GENERIC listIterator();
/** Returns a type-specific list iterator on the list starting at a given index.
*
* @see List#listIterator(int)
*/
KEY_LIST_ITERATOR KEY_GENERIC listIterator( int index );
/** Returns a type-specific view of the portion of this list from the index <code>from</code>, inclusive, to the index <code>to</code>, exclusive.
* @see List#subList(int,int)
* @deprecated As of <code>fastutil</code> 5, replaced by {@link #subList(int,int)}.
*/
@Deprecated
LIST KEY_GENERIC SUBLIST_METHOD( int from, int to );
/** Returns a type-specific view of the portion of this list from the index <code>from</code>, inclusive, to the index <code>to</code>, exclusive.
*
* <P>Note that this specification strengthens the one given in {@link List#subList(int,int)}.
*
* @see List#subList(int,int)
*/
LIST KEY_GENERIC subList(int from, int to);
/** Sets the size of this list.
*
* <P>If the specified size is smaller than the current size, the last elements are
* discarded. Otherwise, they are filled with 0/<code>null</code>/<code>false</code>.
*
* @param size the new size.
*/
void size( int size );
/** Copies (hopefully quickly) elements of this type-specific list into the given array.
*
* @param from the start index (inclusive).
* @param a the destination array.
* @param offset the offset into the destination array where to store the first element copied.
* @param length the number of elements to be copied.
*/
void getElements( int from, KEY_TYPE a[], int offset, int length );
/** Removes (hopefully quickly) elements of this type-specific list.
*
* @param from the start index (inclusive).
* @param to the end index (exclusive).
*/
void removeElements( int from, int to );
/** Add (hopefully quickly) elements to this type-specific list.
*
* @param index the index at which to add elements.
* @param a the array containing the elements.
*/
void addElements( int index, KEY_GENERIC_TYPE a[] );
/** Add (hopefully quickly) elements to this type-specific list.
*
* @param index the index at which to add elements.
* @param a the array containing the elements.
* @param offset the offset of the first element to add.
* @param length the number of elements to add.
*/
void addElements( int index, KEY_GENERIC_TYPE a[], int offset, int length );
#if #keys(primitive)
/**
* @see List#add(Object)
*/
boolean add( KEY_TYPE key );
/**
* @see List#add(int,Object)
*/
void add( int index, KEY_TYPE key );
/**
* @see List#add(int,Object)
*/
boolean addAll( int index, COLLECTION c );
/**
* @see List#add(int,Object)
*/
boolean addAll( int index, LIST c );
/**
* @see List#add(int,Object)
*/
boolean addAll( LIST c );
/**
* @see List#get(int)
*/
KEY_TYPE GET_KEY( int index );
/**
* @see List#indexOf(Object)
*/
int indexOf( KEY_TYPE k );
/**
* @see List#lastIndexOf(Object)
*/
int lastIndexOf( KEY_TYPE k );
/**
* @see List#remove(int)
*/
KEY_TYPE REMOVE_KEY( int index );
/**
* @see List#set(int,Object)
*/
KEY_TYPE set( int index, KEY_TYPE k );
#endif
}
|