boolean (Stream<Content> c1, Stream<Content> c2) { if (c1 == null && c2 == null) return true; if (c1 == null || c2 == null) return false; Iterator<Content> l1 = c1.iterator(); Iterator<Content> l2 = c2.iterator(); while (l1.hasNext() && l2.hasNext()) { if (!contentsEqual(l1.next(), l2.next())) { return false; } } return l1.hasNext() == l2.hasNext(); }