vanessaogassawara / google-collections

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

OrderedIterators support #220

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Since I migrated from C++/STL to java, I’m missing STL algorithms
lower_bound and upper_bound. Please consider adding those methods to
Ordering class. 
http://www.cplusplus.com/reference/algorithm/lower_bound/
http://www.cplusplus.com/reference/algorithm/upper_bound/

Original issue reported on code.google.com by balca...@gmail.com on 15 Aug 2009 at 9:20

GoogleCodeExporter commented 8 years ago
Thanks for the suggestion. When I think about how to include lower_bound and
upper_bound logic in the Google Collection Library, a few ideas come to mind, in
addition to the Ordering methods you proposed.

We could supply SortedIterator and SortedIterable classes, to handle the common 
case
when the elements are ordered but don't belong to a SortedSet. Internally, 
Google has
a little-used, preliminary version of those.

As a different approach, there could be Iterators.filterContiguous(Iterator,
Predicate) and Iterables.filterContiguous(Iterable, Predicate) methods, which 
select
the elements of the iterator or iterable up to the first element that doesn't 
satisfy
the predicate.

For any predicate-based approach, it would be convenient to have methods like
Predicate.lessThan(Number) to create the needed Predicate.

Original comment by jared.l....@gmail.com on 15 Aug 2009 at 6:21

GoogleCodeExporter commented 8 years ago
Generalizing the subject.  Although our OrderedIterators stuff is little-used 
internally, I believe it will be better-used once we take the time to promote 
it.  I'm 
a strong believer in the value of the code.  When we release it, it will 
include the 
ability to view a subiterator limited to a particular interval. This will take 
a while 
though.

Original comment by kevin...@gmail.com on 17 Sep 2009 at 4:59

GoogleCodeExporter commented 8 years ago

Original comment by kevin...@gmail.com on 17 Sep 2009 at 5:45

GoogleCodeExporter commented 8 years ago

Original comment by kevin...@gmail.com on 17 Sep 2009 at 5:57

GoogleCodeExporter commented 8 years ago
This issue has been moved to the Guava project (keeping the same id number). 
Simply replace 'google-collections' with 'guava-libraries' in your address 
bar and it should take you there.

Original comment by kevinb@google.com on 5 Jan 2010 at 11:09