This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public Integer[] myFlatten(Object[] input) throws IllegalArgumentException { | |
if (input == null) return null; | |
List<Integer> result = new ArrayList<Integer>(); | |
for (Object e : input) { | |
if (e instanceof Integer) { | |
result.add((Integer) e); | |
} else if (e instanceof Object[]) { |