public DeprecatedProfiles( Plugins plugins, RuleFinder ruleFinder, RulesRepository[] r, CheckProfile[] deprecatedCheckProfiles) { this.deprecatedRepositories = (RulesRepository[]) ArrayUtils.clone(r); this.plugins = plugins; this.ruleFinder = ruleFinder; this.deprecatedCheckProfiles = (CheckProfile[]) ArrayUtils.clone(deprecatedCheckProfiles); this.deprecatedCheckProfileProviders = new CheckProfileProvider[0]; }
private Map<String, String> getCustomProperties() { String[] commandProperties = (String[]) ArrayUtils.clone(CommandLineConstants.KEYS); sort(commandProperties); Map<String, String> properties = new LinkedHashMap<String, String>(); for (Map.Entry<String, String> entry : getSystemProperties().entrySet()) { if (contains(commandProperties, entry.getKey())) continue; properties.put(entry.getKey(), null); } return properties; }
public static byte[] decreaseOneByte(byte[] byteArray) { byte[] value = ArrayUtils.clone(byteArray); int index = value.length - 1; // Get the rightest none 0x00 byte while (index >= 0 && value[index] == 0) { index--; } if (index >= 0) { value[index]--; } return value; }
/** * @pre components != null; * @pre (forall int i; (i >= 0) && (i < components.length); (components[i] != null) ? * components[i].isLocked()); * @pre (! nullAllowed) ? (forall int i; (i >= 0) && (i < components.length); (components[i] != * null) ? (! components[i].contains(null))); * @post Collections.containsAll(components, new.getComponents()); */ protected AbstractComponentSet( boolean nullAllowed, LockableSet<? extends _ComponentElement_>[] components) { super(nullAllowed); assert components != null; assert Collections.forAll( components, new Assertion<LockableSet<? extends _ComponentElement_>>() { public boolean isTrueFor(LockableSet<? extends _ComponentElement_> o) { return (o == null) || o.isLocked(); } }); assert nullAllowed || Collections.forAll( components, new Assertion<LockableSet<? extends _ComponentElement_>>() { public boolean isTrueFor(LockableSet<? extends _ComponentElement_> o) { return (o == null) || (!o.contains(null)); } }); @SuppressWarnings("unchecked") LockableSet<? extends _ComponentElement_>[] clone = (LockableSet<? extends _ComponentElement_>[]) ArrayUtils.clone(components); $components = clone; }
/** @return a 3-element array of the metadata bits */ public String[] getMdBits() { return (String[]) ArrayUtils.clone(mdBits); }
public Namespace[] getNamespaces() { return (Namespace[]) ArrayUtils.clone(namespaces); }
/** * @brief 数组工具 * @details 详细说明 * @warning 注意事项 * @date 2014-7-11 上午11:25:18 */ @Test public void array() { // 追加元素到数组尾部 int[] array1 = {1, 2}; array1 = ArrayUtils.add(array1, 3); // => [1, 2, 3] System.out.println(array1.length); // 3 System.out.println(array1[2]); // 3 // 删除指定位置的元素 int[] array2 = {1, 2, 3}; array2 = ArrayUtils.remove(array2, 2); // => [1, 2] System.out.println(array2.length); // 2 // 截取部分元素 int[] array3 = {1, 2, 3, 4}; array3 = ArrayUtils.subarray(array3, 1, 3); // => [2, 3] System.out.println(array3.length); // 2 // 数组拷贝 String[] array4 = {"aaa", "bbb", "ccc"}; String[] copied = (String[]) ArrayUtils.clone(array4); // => {"aaa", "bbb", "ccc"} System.out.println(copied.length); // 3 // 判断是否包含某元素 String[] array5 = {"aaa", "bbb", "ccc", "bbb"}; boolean result1 = ArrayUtils.contains(array5, "bbb"); // => true System.out.println(result1); // true // 判断某元素在数组中出现的位置(从前往后,没有返回-1) int result2 = ArrayUtils.indexOf(array5, "bbb"); // => 1 System.out.println(result2); // 1 // 判断某元素在数组中出现的位置(从后往前,没有返回-1) int result3 = ArrayUtils.lastIndexOf(array5, "bbb"); // => 3 System.out.println(result3); // 3 // 数组转Map Map<Object, Object> map = ArrayUtils.toMap( new String[][] { {"key1", "value1"}, {"key2", "value2"} }); System.out.println(map.get("key1")); // "value1" System.out.println(map.get("key2")); // "value2" // 判断数组是否为空 Object[] array61 = new Object[0]; Object[] array62 = null; Object[] array63 = new Object[] {"aaa"}; System.out.println(ArrayUtils.isEmpty(array61)); // true System.out.println(ArrayUtils.isEmpty(array62)); // true // 判断数组长度是否相等 Object[] array71 = new Object[] {"aa", "bb", "cc"}; Object[] array72 = new Object[] {"dd", "ee", "ff"}; System.out.println(ArrayUtils.isSameLength(array71, array72)); // true // 判断数组元素内容是否相等 Object[] array81 = new Object[] {"aa", "bb", "cc"}; Object[] array82 = new Object[] {"aa", "bb", "cc"}; System.out.println(ArrayUtils.isEquals(array81, array82)); // Integer[] 转化为 int[] Integer[] array9 = new Integer[] {1, 2}; int[] result = ArrayUtils.toPrimitive(array9); System.out.println(result.length); // 2 System.out.println(result[0]); // 1 // int[] 转化为 Integer[] int[] array10 = new int[] {1, 2}; Integer[] result10 = ArrayUtils.toObject(array10); System.out.println(result.length); // 2 System.out.println(result10[0].intValue()); // 1 }
/** * Obtain the array of items * * @return an array of items */ public Item[] getRecentSubmissions() { return (Item[]) ArrayUtils.clone(items); }
/** * Construct a new RecentSubmissions object to represent the passed array of items * * @param items */ public RecentSubmissions(Item[] items) { this.items = (Item[]) ArrayUtils.clone(items); }
/** * Returns list of metadata selectors used to compose the description element * * @return selector list - format 'schema.element[.qualifier]' */ public static String[] getDescriptionSelectors() { return (String[]) ArrayUtils.clone(descriptionFields); }
/** @basic */ public final LockableSet<? extends _ComponentElement_>[] getComponents() { @SuppressWarnings("unchecked") LockableSet<? extends _ComponentElement_>[] clone = (LockableSet<? extends _ComponentElement_>[]) ArrayUtils.clone($components); return clone; }
/* (non-Javadoc) * @see org.dspace.browse.BrowseDAO#setSelectValues(java.lang.String[]) */ public void setSelectValues(String[] selectValues) { this.selectValues = (String[]) ArrayUtils.clone(selectValues); this.rebuildQuery = true; }
/* (non-Javadoc) * @see org.dspace.browse.BrowseDAO#setCountValues(java.lang.String[]) */ public void setCountValues(String[] fields) { this.countValues = (String[]) ArrayUtils.clone(fields); this.rebuildQuery = true; }
/* (non-Javadoc) * @see org.dspace.browse.BrowseDAO#getSelectValues() */ public String[] getSelectValues() { return (String[]) ArrayUtils.clone(selectValues); }
/* (non-Javadoc) * @see org.dspace.browse.BrowseDAO#getCountValues() */ public String[] getCountValues() { return (String[]) ArrayUtils.clone(this.countValues); }