com.ibm.security.certclient.util

Class PkArray



  • public class PkArray
    extends Object
    This is a utility class. It contains only static methods. All methods perform operations on arrays.
    Author:
    Rod Mancisidor
    • Constructor Detail

      • PkArray

        public PkArray()
    • Method Detail

      • slice

        public static Object[] slice(Object[] array,
                                     int from,
                                     int to)
        Return the slice of an array. A slice is an array that contains a shallow copy of the elements of another array and may be truncated at the beginning or end.
        Parameters:
        array - the array to slice
        from - the index of the first element of array that is placed in the slice. If negative, then start to count from the end
        to - the index of the first element of array that is not placed in the slice. If negative, then start to count from the end
        Returns:
        the slice
        Throws:
        IllegalArgumentException - if to or from fall outside the array
      • append

        public static Object[] append(Object[] a1,
                                      Object[] a2)
        Return the result of appending two arrays
      • isMember

        public static boolean isMember(Object member,
                                       Object[] array)
        Return true if and only if member equals any of the elements of array
      • isMember

        public static boolean isMember(Object member,
                                       Object[] array,
                                       Comparator<Object> comp)
        Return true if and only if member equals any of the elements of array using comp as the comparator object
      • areEqual

        public static boolean areEqual(Object[] lhs,
                                       Object[] rhs)
        Return true if and only if the array lhs and the array rhs have the same length and:

        for all i in 0..lhs.length, lhs[i].equals(rhs[i])
      • areEqual

        public static boolean areEqual(byte[] lhs,
                                       byte[] rhs)
        Return true if and only if the array lhs and the array rhs have the same length and:

        for all i in 0..lhs.length, lhs[i] == rhs[i]
      • isPrefix

        public static boolean isPrefix(byte[] lhs,
                                       byte[] rhs)
        Return true if and only if lhs.length <= rhs.length and:

         for all i in 0..lhs.length, lhs[i] == rhs[i]
         

© Copyright IBM Corp. 1998, 2021 All Rights Reserved.