void mixLists( LinkedList<Integer> left, LinkedList<Integer> right, ArrayList<LinkedList<Integer>> mix, LinkedList<Integer> before) { if (before.isEmpty() || right.isEmpty()) { LinkedList<Integer> l = new LinkedList<>(); l = (LinkedList<Integer>) before.clone(); l.addAll(left); l.addAll(right); mix.add(l); return; } int hl = left.removeFirst(); before.addLast(hl); mixLists(left, right, mix, before); before.removeLast(); left.addFirst(hl); int hr = right.removeFirst(); before.addLast(hr); mixLists(left, right, mix, before); before.removeLast(); right.addFirst(hr); }
@SuppressWarnings("unchecked") public ViewComponentInfo( int ix, int iy, int iw, int ih, int mw, int mh, LinkedList<ViewComponentInfo> ic) { x = ix; y = iy; width = iw; height = ih; measuredWidth = mw; measuredHeight = mh; if (ic != null) children = (LinkedList<ViewComponentInfo>) ic.clone(); else children = null; }
@SuppressWarnings("unchecked") LinkedList<ViewComponentInfo> getChildren() { return (LinkedList<ViewComponentInfo>) children.clone(); }