Posts

Showing posts from June, 2016

How to intersect the data of two collections

    /**      * Supports intersect two collections and return a single intersected collection      * @param a First collection parameter      * @param b Second collection parameter      * @return Intersected collection of results      */       public static Collection intersect (Collection a, Collection b)       {           Collection result = new ArrayList ();              try {                for (T t: a){                      if (b.remove (t)) {                          result.add (t);                      }                  }   ...