yangxu998 / guava-libraries

Automatically exported from code.google.com/p/guava-libraries
Apache License 2.0
0 stars 0 forks source link

want comparison on Iterable-s #659

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
The method Iterables.elementsEqual essentially transforms method equals on T 
into equals on Iterable<T>. I recently needed to essentially turn a 
Comparator<T> into a Comparator<Iterable<T>>. This would have been OK:

  int Iterables.compareElements(Comparator<T>, Iterable<T>, Iterable<T>)

Original issue reported on code.google.com by radugrig...@gmail.com on 12 Jul 2011 at 10:03

GoogleCodeExporter commented 9 years ago
Fortunately, Guava already has a much nicer way of doing this!

  Ordering<Iterable<T>> o = Ordering.from(comparator).lexicographical();

http://guava-libraries.googlecode.com/svn/tags/release09/javadoc/com/google/comm
on/collect/Ordering.html#lexicographical()

Original comment by cgdec...@gmail.com on 12 Jul 2011 at 10:53

GoogleCodeExporter commented 9 years ago
This issue has been migrated to GitHub.

It can be found at https://github.com/google/guava/issues/<id>

Original comment by cgdecker@google.com on 1 Nov 2014 at 4:15

GoogleCodeExporter commented 9 years ago

Original comment by cgdecker@google.com on 3 Nov 2014 at 9:09