先貼代碼:編程
DuplicateCenter { main(String[] args) { List names = Arrays.()names=ImmutableSet.( Iterables.( namesPredicates.(Predicates.()))).asList()Iterable filtered = Iterables.( Iterables.(names(()()))())Iterator<String>nameIterator=filtered.iterator()(nameIterator.hasNext()){ System..println(nameIterator.next())} } LengthLessThanPredicate Predicate<String> { LengthLessThanPredicate(length) { .= length} apply(String s) { s.length() < } } OrPredicate Predicate<String> { Predicate<String> Predicate<String> OrPredicate(Predicate SPredicate T){ .=S.=T} apply(String s) { .apply(s)||.apply(s)} } Predicate<String> lengthLessThan(length) { LengthLessThanPredicate(length)} Predicate<String>or(Predicate SPredicate T){ OrPredicate(ST)} Predicate<String>isEqualTo(String str){ EqualtoPredicate(str)} EqualtoPredicate Predicate<String> { String EqualtoPredicate(String str) { .=str} apply(String s) { s.equals()} } }
FluentIterable<> Iterable<> { Iterable<> FluentIterable(Iterable<> iterable) { .= iterable} <> FluentIterable<> with(Iterable<> iterable) { FluentIterable<>(iterable)} Iterator<> iterator() { ..iterator()} FluentIterable<> filter(Predicate<? > predicate) { Iterable filtered = Iterables.(.predicate).= filtered} }
函數式編程的樣子app
很明朗有沒有函數式編程