com.fasterxml.jackson.core.util

Class ArraysCompat



  • public class ArraysCompat
    extends Object
    ArraysCompat implements Arrays methods which are not available in Android 2.2 (FroYo).
    • Constructor Summary

      Constructors 
      Constructor and Description
      ArraysCompat() 
    • Method Summary

      Methods 
      Modifier and Type Method and Description
      static char[] copyOf(char[] original, int newLength)
      Copies newLength elements from original into a new array.
      static int[] copyOf(int[] original, int newLength)
      Copies newLength elements from original into a new array.
      static <T> T[] copyOf(T[] original, int newLength)
      Copies newLength elements from original into a new array.
      static char[] copyOfRange(char[] original, int start, int end)
      Copies elements from original into a new array, from indexes start (inclusive) to end (exclusive).
      static int[] copyOfRange(int[] original, int start, int end)
      Copies elements from original into a new array, from indexes start (inclusive) to end (exclusive).
      static <T> T[] copyOfRange(T[] original, int start, int end)
      Copies elements from original into a new array, from indexes start (inclusive) to end (exclusive).
    • Constructor Detail

      • ArraysCompat

        public ArraysCompat()
    • Method Detail

      • copyOf

        public static char[] copyOf(char[] original,
                    int newLength)
        Copies newLength elements from original into a new array. If newLength is greater than original.length, the result is padded with the value '\\u0000'.
        Parameters:
        original - the original array
        newLength - the length of the new array
        Returns:
        the new array
        Throws:
        NegativeArraySizeException - if newLength < 0
        NullPointerException - if original == null
      • copyOf

        public static int[] copyOf(int[] original,
                   int newLength)
        Copies newLength elements from original into a new array. If newLength is greater than original.length, the result is padded with the value 0.
        Parameters:
        original - the original array
        newLength - the length of the new array
        Returns:
        the new array
        Throws:
        NegativeArraySizeException - if newLength < 0
        NullPointerException - if original == null
      • copyOf

        public static <T> T[] copyOf(T[] original,
                     int newLength)
        Copies newLength elements from original into a new array. If newLength is greater than original.length, the result is padded with the value null.
        Parameters:
        original - the original array
        newLength - the length of the new array
        Returns:
        the new array
        Throws:
        NegativeArraySizeException - if newLength < 0
        NullPointerException - if original == null
      • copyOfRange

        public static char[] copyOfRange(char[] original,
                         int start,
                         int end)
        Copies elements from original into a new array, from indexes start (inclusive) to end (exclusive). The original order of elements is preserved. If end is greater than original.length, the result is padded with the value '\\u0000'.
        Parameters:
        original - the original array
        start - the start index, inclusive
        end - the end index, exclusive
        Returns:
        the new array
        Throws:
        ArrayIndexOutOfBoundsException - if start < 0 || start > original.length
        IllegalArgumentException - if start > end
        NullPointerException - if original == null
      • copyOfRange

        public static int[] copyOfRange(int[] original,
                        int start,
                        int end)
        Copies elements from original into a new array, from indexes start (inclusive) to end (exclusive). The original order of elements is preserved. If end is greater than original.length, the result is padded with the value 0.
        Parameters:
        original - the original array
        start - the start index, inclusive
        end - the end index, exclusive
        Returns:
        the new array
        Throws:
        ArrayIndexOutOfBoundsException - if start < 0 || start > original.length
        IllegalArgumentException - if start > end
        NullPointerException - if original == null
      • copyOfRange

        public static <T> T[] copyOfRange(T[] original,
                          int start,
                          int end)
        Copies elements from original into a new array, from indexes start (inclusive) to end (exclusive). The original order of elements is preserved. If end is greater than original.length, the result is padded with the value null.
        Parameters:
        original - the original array
        start - the start index, inclusive
        end - the end index, exclusive
        Returns:
        the new array
        Throws:
        ArrayIndexOutOfBoundsException - if start < 0 || start > original.length
        IllegalArgumentException - if start > end
        NullPointerException - if original == null

Copyright © 2012-2014 FasterXML. All Rights Reserved.