Here you can find the source of removeFirst(String[] args)
Parameter | Description |
---|---|
args | a parameter |
public static String[] removeFirst(String[] args)
//package com.java2s; //License from project: Open Source License import java.util.*; public class Main { /**//from w w w .j ava2 s .co m * Removes first item from a string array * * @param args * @return */ public static String[] removeFirst(String[] args) { List<String> out = fromArray(args); if (!out.isEmpty()) { out.remove(0); } return toArray(out); } /** * Converts string array to ArrayList<String>, remove empty strings * * @param values * @return */ public static List<String> fromArray(String... values) { List<String> results = new ArrayList<>(); Collections.addAll(results, values); results.remove(""); return results; } /** * Converts ArrayList<String> to string array * * @param list * @return */ public static String[] toArray(List<String> list) { return list.toArray(new String[list.size()]); } }