Java Array Shift shiftLeft(Object[] arr, int startIndex, int endIndex)

Here you can find the source of shiftLeft(Object[] arr, int startIndex, int endIndex)

Description

overwrites left cell with right cell.

License

Open Source License

Parameter

Parameter Description
arr a parameter
startIndex a parameter
endIndex a parameter

Declaration

public static void shiftLeft(Object[] arr, int startIndex, int endIndex) 

Method Source Code

//package com.java2s;
/*/*from   ww w . j ava  2  s  .co  m*/
 * GNU GENERAL PUBLIC LICENSE
 Version 2, June 1991
    
 */

public class Main {
    /**
     * overwrites left cell with right cell. If arr='01234', startIndex=1 and endIndex=3 then arr will be <12>234
     * (without <>).
     * 
     * @param arr
     * @param startIndex
     * @param endIndex
     */
    public static void shiftLeft(Object[] arr, int startIndex, int endIndex) {
        for (int i = startIndex; i < endIndex; i++) {
            arr[i - 1] = arr[i];
        }
    }
}

Related

  1. shiftEnum(E current, E[] values, int delta)
  2. shiftLeft(byte[] array)
  3. shiftLeft(byte[] b1, int bytes)
  4. shiftLeft(byte[] block, byte[] output)
  5. shiftLeft(byte[] data, int shiftBy)
  6. shiftLeft(Object[] array, int amount)
  7. shiftLeft(Object[] object)
  8. shiftLeft1(T[] array)
  9. shiftLeftAndFill(byte[] array, int positions)