algorithms/src/arrays/FlattenArrayImpl.java
/**
	 * recursive flatten function for deeply nested arrays.
	 * @param objs
	 * @param flattenList
	 */
recursive flatten function for deeply nested arrays.
@param objs
@param flattenList
recursive flatten function for deeply nested arrays . @param objs @param flattenList
private void flatten(Object[] objs,List<Integer> flattenList) {
		for(Object obj: objs) {
			if(obj == null) {
				throw new RuntimeException("NULL values are not supported");
			}else if(obj instanceof Integer) {
				flattenList.add((Integer) obj);
			}else if(obj instanceof Object[] ) {
				flatten((Object[]) obj, flattenList);
			}else {
				throw new RuntimeException("only flattening integers is supported");
			}
		}
	}
private void flatten ( Object [ ] objs , List < Integer > flattenList ) { for ( Object obj : objs ) { if ( obj == null ) { throw new RuntimeException ( "NULL values are not supported" ) ; } else if ( obj instanceof Integer ) { flattenList . add ( ( Integer ) obj ) ; } else if ( obj instanceof Object [ ] ) { flatten ( ( Object [ ] ) obj , flattenList ) ; } else { throw new RuntimeException ( "only flattening integers is supported" ) ; } } }
recursive flatten function for deeply nested arrays.
recursive flatten function for deeply nested arrays .