/** * Copies the contents of the stack into a native array. Note that this will NOT * pop them out of the stack. The front of the list will be the top of the stack. * * @return an <code>byte[]</code> value */ public byte[] toArray() { byte[] retval = _list.toArray(); reverse( retval, 0, size() ); return retval; }
/** * Copies the contents of the stack into a native array. Note that this will NOT * pop them out of the stack. The front of the list will be the top of the stack. * * @return an <code>short[]</code> value */ public short[] toArray() { short[] retval = _list.toArray(); reverse( retval, 0, size() ); return retval; }
/** * Copies the contents of the stack into a native array. Note that this will NOT * pop them out of the stack. The front of the list will be the top of the stack. * * @return an <code>char[]</code> value */ public char[] toArray() { char[] retval = _list.toArray(); reverse( retval, 0, size() ); return retval; }
/** * Copies the contents of the stack into a native array. Note that this will NOT * pop them out of the stack. The front of the list will be the top of the stack. * * @return an <code>int[]</code> value */ public int[] toArray() { int[] retval = _list.toArray(); reverse( retval, 0, size() ); return retval; }
/** * Copies the contents of the stack into a native array. Note that this will NOT * pop them out of the stack. The front of the list will be the top of the stack. * * @return an <code>long[]</code> value */ public long[] toArray() { long[] retval = _list.toArray(); reverse( retval, 0, size() ); return retval; }
/** * Copies the contents of the stack into a native array. Note that this will NOT * pop them out of the stack. The front of the list will be the top of the stack. * * @return an <code>float[]</code> value */ public float[] toArray() { float[] retval = _list.toArray(); reverse( retval, 0, size() ); return retval; }
/** * Copies the contents of the stack into a native array. Note that this will NOT * pop them out of the stack. The front of the list will be the top of the stack. * * @return an <code>double[]</code> value */ public double[] toArray() { double[] retval = _list.toArray(); reverse( retval, 0, size() ); return retval; }
/** * Returns a String representation of the list, top to bottom. * * @return a <code>String</code> value */ public String toString() { final StringBuilder buf = new StringBuilder( "{" ); for ( int i = _list.size() - 1; i > 0; i-- ) { buf.append( _list.get( i ) ); buf.append( ", " ); } if ( size() > 0 ) { buf.append( _list.get( 0 ) ); } buf.append( "}" ); return buf.toString(); }
/** * Reverse the order of the elements in the range of the list. * * @param dest the array of data * @param from the inclusive index at which to start reversing * @param to the exclusive index at which to stop reversing */ private void reverse( int[] dest, int from, int to ) { if ( from == to ) { return; // nothing to do } if ( from > to ) { throw new IllegalArgumentException( "from cannot be greater than to" ); } for ( int i = from, j = to - 1; i < j; i++, j-- ) { swap( dest, i, j ); } }
/** * Reverse the order of the elements in the range of the list. * * @param dest the array of data * @param from the inclusive index at which to start reversing * @param to the exclusive index at which to stop reversing */ private void reverse( float[] dest, int from, int to ) { if ( from == to ) { return; // nothing to do } if ( from > to ) { throw new IllegalArgumentException( "from cannot be greater than to" ); } for ( int i = from, j = to - 1; i < j; i++, j-- ) { swap( dest, i, j ); } }
/** * Reverse the order of the elements in the range of the list. * * @param dest the array of data * @param from the inclusive index at which to start reversing * @param to the exclusive index at which to stop reversing */ private void reverse( short[] dest, int from, int to ) { if ( from == to ) { return; // nothing to do } if ( from > to ) { throw new IllegalArgumentException( "from cannot be greater than to" ); } for ( int i = from, j = to - 1; i < j; i++, j-- ) { swap( dest, i, j ); } }
/** * Reverse the order of the elements in the range of the list. * * @param dest the array of data * @param from the inclusive index at which to start reversing * @param to the exclusive index at which to stop reversing */ private void reverse( double[] dest, int from, int to ) { if ( from == to ) { return; // nothing to do } if ( from > to ) { throw new IllegalArgumentException( "from cannot be greater than to" ); } for ( int i = from, j = to - 1; i < j; i++, j-- ) { swap( dest, i, j ); } }
/** * Reverse the order of the elements in the range of the list. * * @param dest the array of data * @param from the inclusive index at which to start reversing * @param to the exclusive index at which to stop reversing */ private void reverse( long[] dest, int from, int to ) { if ( from == to ) { return; // nothing to do } if ( from > to ) { throw new IllegalArgumentException( "from cannot be greater than to" ); } for ( int i = from, j = to - 1; i < j; i++, j-- ) { swap( dest, i, j ); } }
/** * Reverse the order of the elements in the range of the list. * * @param dest the array of data * @param from the inclusive index at which to start reversing * @param to the exclusive index at which to stop reversing */ private void reverse( byte[] dest, int from, int to ) { if ( from == to ) { return; // nothing to do } if ( from > to ) { throw new IllegalArgumentException( "from cannot be greater than to" ); } for ( int i = from, j = to - 1; i < j; i++, j-- ) { swap( dest, i, j ); } }
/** * Reverse the order of the elements in the range of the list. * * @param dest the array of data * @param from the inclusive index at which to start reversing * @param to the exclusive index at which to stop reversing */ private void reverse( char[] dest, int from, int to ) { if ( from == to ) { return; // nothing to do } if ( from > to ) { throw new IllegalArgumentException( "from cannot be greater than to" ); } for ( int i = from, j = to - 1; i < j; i++, j-- ) { swap( dest, i, j ); } }
/** * Returns a String representation of the list, top to bottom. * * @return a <code>String</code> value */ public String toString() { final StringBuilder buf = new StringBuilder( "{" ); for ( int i = _list.size() - 1; i > 0; i-- ) { buf.append( _list.get( i ) ); buf.append( ", " ); } if ( size() > 0 ) { buf.append( _list.get( 0 ) ); } buf.append( "}" ); return buf.toString(); }
/** * Returns a String representation of the list, top to bottom. * * @return a <code>String</code> value */ public String toString() { final StringBuilder buf = new StringBuilder( "{" ); for ( int i = _list.size() - 1; i > 0; i-- ) { buf.append( _list.get( i ) ); buf.append( ", " ); } if ( size() > 0 ) { buf.append( _list.get( 0 ) ); } buf.append( "}" ); return buf.toString(); }
/** * Returns a String representation of the list, top to bottom. * * @return a <code>String</code> value */ public String toString() { final StringBuilder buf = new StringBuilder( "{" ); for ( int i = _list.size() - 1; i > 0; i-- ) { buf.append( _list.get( i ) ); buf.append( ", " ); } if ( size() > 0 ) { buf.append( _list.get( 0 ) ); } buf.append( "}" ); return buf.toString(); }
/** * Returns a String representation of the list, top to bottom. * * @return a <code>String</code> value */ public String toString() { final StringBuilder buf = new StringBuilder( "{" ); for ( int i = _list.size() - 1; i > 0; i-- ) { buf.append( _list.get( i ) ); buf.append( ", " ); } if ( size() > 0 ) { buf.append( _list.get( 0 ) ); } buf.append( "}" ); return buf.toString(); }
/** * Returns a String representation of the list, top to bottom. * * @return a <code>String</code> value */ public String toString() { final StringBuilder buf = new StringBuilder( "{" ); for ( int i = _list.size() - 1; i > 0; i-- ) { buf.append( _list.get( i ) ); buf.append( ", " ); } if ( size() > 0 ) { buf.append( _list.get( 0 ) ); } buf.append( "}" ); return buf.toString(); }