Java算法包 jga

fmms 13年前
     <p>jga (Generic Algorithms for Java) 是一个 Java 的通用算法函数库,旨在提供一些常用的函数和表达式的封装。</p>    <p>示例代码:</p>    <pre class="brush:java; toolbar: true; auto-links: false;">List<Fruit> citrus = Arrays.asList(     grapefruit, lemon, lemon, lemon, lime, lime, orange, orange ); ... for(Fruit f : unique(citrus)) {     System.out.println(f); }  import net.sf.jga.util.GenericComparator; ... static public Comparator comp =     new GenericComparator(new GetProperty(Fruit.class, "Name"));  BinaryFunctor<Fruit,Fruit,Boolean> sameKind = new EqualTo<Fruit>(Fruit.comp);          for(Fruit f : unique(citrus, sameKind)) {     System.out.println(f); }</pre>    <p></p>    <p><strong>项目主页:</strong><a href="http://www.open-open.com/lib/view/home/1326806314687" target="_blank">http://www.open-open.com/lib/view/home/1326806314687</a></p>