Skip to content

Instantly share code, notes, and snippets.

@h2000
Forked from carstenlenz/filter
Created January 29, 2012 15:23

Revisions

  1. @carstenlenz carstenlenz created this gist Sep 16, 2011.
    5 changes: 5 additions & 0 deletions filter
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,5 @@
    ${retIt:newType(java.lang.Iterable)}<${iterable_type}> ${name:newName(retIt)} = ${itbls:newType(com.google.common.collect.Iterables)}.filter(${iterable}, new ${pred:newType(com.google.common.base.Predicate)}<${iterable_type}>() {
    @Override public boolean apply(${iterable_type} ${input}) {
    return ${false};
    }
    });
    5 changes: 5 additions & 0 deletions function
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,5 @@
    new ${fun:newType(com.google.common.base.Function)}<${from_type}, ${to_type}>() {
    @Override public ${to_type} apply(${from_type} ${input}) {
    return ${cursor};
    }
    }
    5 changes: 5 additions & 0 deletions predicate
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,5 @@
    new ${pred:newType(com.google.common.base.Predicate)}<${type}>() {
    @Override public boolean apply(${type} ${input}) {
    return ${cursor};
    }
    }
    5 changes: 5 additions & 0 deletions transform
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,5 @@
    ${retIt:newType(java.lang.Iterable)}<${to_type}> ${name:newName(retIt)} = ${itbls:newType(com.google.common.collect.Iterables)}.transform(${iterable}, new ${fun:newType(com.google.common.base.Function)}<${iterable_type}, ${to_type}>() {
    @Override public ${to_type} apply(${iterable_type} ${input}) {
    return ${null};
    }
    });