Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* This is a program for Language Grid Core Node. This combines multiple language resources and provides composite language services.
* Copyright (C) 2005-2011 NICT Language Grid Project.
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 2.1 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser
* General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see .
*/
package jp.go.nict.langrid.commons.util;
import java.io.UnsupportedEncodingException;
import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import jp.go.nict.langrid.commons.lang.ClassUtil;
import jp.go.nict.langrid.commons.lang.reflect.GenericsUtil;
import jp.go.nict.langrid.commons.transformer.TransformationException;
import jp.go.nict.langrid.commons.transformer.Transformer;
import jp.go.nict.langrid.commons.util.function.Predicate;
import jp.go.nict.langrid.commons.util.stream.IteratorProvider;
import jp.go.nict.langrid.commons.util.stream.Stream;
/**
*
*
* @author Takao Nakaguchi
*/
public class ArrayUtil {
/**
*
*
*/
public static T[] array(T... elements){
return elements;
}
@SuppressWarnings("unchecked")
public static T[] array(Class elementClass, Object... elements){
Object ret = Array.newInstance(elementClass, elements.length);
System.arraycopy(
elements,
0,
ret,
0,
elements.length
);
return (T[])ret;
}
/**
*
*
*/
public static Character[] box(char[] elements){
Character[] ret = new Character[elements.length];
for(int i = 0; i < elements.length; i++){
ret[i] = elements[i];
}
return ret;
}
/**
*
*
*/
public static T first(T[] elements){
return elements[0];
}
/**
*
*
*/
public static T last(T[] elements){
return elements[elements.length - 1];
}
/**
*
*
*/
public static T getWithinBound(T[] elements, int index){
if(index < 0 || elements.length <= index){
return null;
} else{
return elements[index];
}
}
/**
*
*
*/
public static String toString(Object array){
Transformer