Home >Backend Development >PHP Tutorial >java代码转PHP代码

java代码转PHP代码

WBOY
WBOYOriginal
2016-06-13 11:00:461005browse

java代码转PHP代码,高手进

import java.util.ArrayList;import java.util.Arrays;import java.util.List;public class ArrayAssemble {	@SuppressWarnings("unchecked")	public static void main(String[] args) {		String[] arrOfInt = { "红", "橙", "黄","黑" };		@SuppressWarnings("unused")		String[] arrOfChar1 = { "L", "XL" };		@SuppressWarnings("unused")		String[] arrOfChar2 = { "麻", "晴纶","看" };		String[] arrOfChar3 = { "奎", "康" };		 String[] arrOfStr = { "lmy", "lyb", "mz", "yx" };		System.out.println("以下是组合后的数组");//		Object[][] objectsArrays = assembleArraysToPlanerArray(new Object[][] {arrOfInt, arrOfChar1, arrOfChar2, arrOfChar3,arrOfStr });		Object[][] objectsArrays = assembleArraysToPlanerArray(new Object[][] { arrOfChar1,arrOfChar2, arrOfChar3 });//		Object[][] objectsArrays = assembleArraysToPlanerArray(new Object[][] { arrOfChar1,arrOfChar2 });		int i = 0;		for (Object[] objArrays : objectsArrays) {			i++;			System.out.println(i + "=" + Arrays.toString(objArrays));		}	}	// 方法一的辅助方法:将一个数组类型或对象类型的List与数组组合,并返回List	@SuppressWarnings("unchecked")	public static List assembleArrayToList(List aList, Object[] array) {		List arrList = new ArrayList();		// 遍历aList,将array与aList进行组合		for (int i = 0; i <div class="clear">
                 
              
              
        
            </div>
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn