| 
 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.joe_e.array.ConstArray<E>
org.joe_e.array.ImmutableArray<E>
org.joe_e.array.PowerlessArray<Integer>
org.joe_e.array.IntArray
public final class IntArray
An immutable array of int.
| Nested Class Summary | |
|---|---|
| static class | IntArray.BuilderA IntArrayfactory. | 
| Method Summary | ||
|---|---|---|
| static IntArray | array()Construct an empty IntArray | |
| static IntArray | array(int... ints)Constructs an array of ints. | |
| static IntArray | array(int value)Construct a IntArraywith one element. | |
| static IntArray | array(int value1,
      int value2)Construct a IntArraywith two elements. | |
| static IntArray | array(int value1,
      int value2,
      int value3)Construct a IntArraywith three elements. | |
| static IntArray | array(int value1,
      int value2,
      int value3,
      int value4)Construct a IntArraywith four elements. | |
| static IntArray.Builder | builder()Get a IntArray.Builder. | |
| static IntArray.Builder | builder(int estimate)Get a IntArray.Builder. | |
|  boolean | equals(Object other)Test for equality with another object | |
|  Integer | get(int i)Creates a Integerfor a specifiedint. | |
|  int | getInt(int i)Gets the intat a specified position. | |
|  int | hashCode()Computes a digest of the array for hashing. | |
|  int | length()Gets the length of the array. | |
| 
 | toArray(T[] prototype)Return a mutable copy of the array | |
|  int[] | toIntArray()Creates a mutable copy of the intarray | |
|  String | toString()Return a string representation of the array | |
|  IntArray | with(int newInt)Creates a IntArraywith an appendedint. | |
|  IntArray | with(Integer newInt)Creates a IntArray | |
|  IntArray | without(int i)Return a new IntArraythat contains the same elements
 as this one excluding the element at a specified index | |
| Methods inherited from class org.joe_e.array.PowerlessArray | 
|---|
| array | 
| Methods inherited from class org.joe_e.array.ConstArray | 
|---|
| iterator | 
| Methods inherited from class java.lang.Object | 
|---|
| clone, finalize, getClass, notify, notifyAll, wait, wait, wait | 
| Method Detail | 
|---|
public static IntArray array(int... ints)
ints.
ints - each elementpublic static IntArray array()
IntArray
public static IntArray array(int value)
IntArray with one element.
value - the valuepublic static IntArray array(int value1,
                             int value2)
IntArray with two elements.
value1 - the first valuevalue2 - the second valuepublic static IntArray array(int value1,
                             int value2,
                             int value3)
IntArray with three elements.
value1 - the first valuevalue2 - the second valuevalue3 - the third valuepublic static IntArray array(int value1,
                             int value2,
                             int value3,
                             int value4)
IntArray with four elements.
value1 - the first valuevalue2 - the second valuevalue3 - the third valuevalue4 - the fourth valuepublic boolean equals(Object other)
equals in class ConstArray<Integer>other - the reference object with which to compare.
ConstArray with the same
         contents as this arrayObject.hashCode(), 
HashMappublic int hashCode()
Arrays.hashCode(Object[]) called on a Java array
 containing the same elements.
hashCode in interface SelflesshashCode in class ConstArray<Integer>Object.equals(java.lang.Object), 
System.identityHashCode(java.lang.Object)public String toString()
toString in class ConstArray<Integer>public int length()
length in class ConstArray<Integer>public Integer get(int i)
Integer for a specified int.
get in class ConstArray<Integer>i - position of the element to return
ArrayIndexOutOfBoundsException - i is out of boundspublic <T> T[] toArray(T[] prototype)
toArray in class ConstArray<Integer>prototype - prototype of the array to copy into
ConstArray
     of the same type as prototype
ArrayStoreException - if an element cannot be stored in the arraypublic IntArray with(Integer newInt)
IntArray with an appended Integer.
- Overrides:
- within class- PowerlessArray<Integer>
- 
- Parameters:
- newInt- the element to append
- Returns:
- the new array
- Throws:
- NullPointerException-- newIntis null
 
getInt
public int getInt(int i)
- Gets the intat a specified position.
 
- 
- Parameters:
- i- position of the element to return
- Throws:
- ArrayIndexOutOfBoundsException-- iis out of bounds
 
toIntArray
public int[] toIntArray()
- Creates a mutable copy of the intarray
 
- 
 
with
public IntArray with(int newInt)
- Creates a IntArraywith an appendedint.
 
- 
- Parameters:
- newInt- the element to append
 
without
public IntArray without(int i)
- Return a new IntArraythat contains the same elements
 as this one excluding the element at a specified index
 
- 
- Overrides:
- withoutin class- PowerlessArray<Integer>
 
- 
- Parameters:
- i- the index of the element to exclude
- Returns:
- the new array
 
builder
public static IntArray.Builder builder()
- Get a IntArray.Builder.  This is equivalent to the
 constructor.
 
- 
- Returns:
- a new builder instance, with the default internal array length
 
builder
public static IntArray.Builder builder(int estimate)
- Get a IntArray.Builder.  This is equivalent to the
 constructor.
 
- 
- Parameters:
- estimate- estimated array length
- Returns:
- a new builder instance
 
  
      Overview  
      Package  
    Class  
      Tree  
      Deprecated  
      Index  
      Help  
   
 
 
 
 PREV CLASS 
 NEXT CLASS 
  FRAMES   
 NO FRAMES   
 All Classes
 
 
  SUMMARY: NESTED | FIELD | CONSTR | METHOD 
DETAIL: FIELD | CONSTR | METHOD