Comments (6)
Yes this is an issue, thanks for reporting it.
hasNext() does advance the pointer. It does not affect typical usage of the
iterator, but it's wrong nonetheless.
But I have not been able to reproduce that particular issue with Guava. The
following copies from a FilteringIterator into a Guava ImmutableCollection and
the test passes:
@Test
public void testFilteringIterator() {
List<String> testList = Arrays.asList("abc", "bcd", "cde");
FilteringIterator<String> iterator = new FilteringIterator<String>(testList.iterator()) {
@Override
public boolean isValid(String object) {
return true;
}
};
ImmutableCollection<String> immutableCollection = ImmutableList.<String>builder().addAll(iterator).build();
assertThat(immutableCollection.size(), is(3));
assertThat(immutableCollection.toString(), is("[abc, bcd, cde]"));
}
It's possible there is some other way of copying into an ImmutableCollection
that I'm not aware of could hit this issue though. As a workaround in the
meantime the usage above seems to work for me.
Thanks for reporting this, it will be fixed!
Original comment by [email protected]
on 27 Sep 2013 at 2:16
- Changed state: Accepted
from cqengine.
[deleted comment]
from cqengine.
Sorry cut and past error.
It occurs when using ImmutableSet/List.copyOf(Iterator) as it uses the
hasNext() to optimize the returned List / Set. This reproduction case works
with Guava 13 and on. I had never attempted to use the builder in place of the
copyOf method and so hit this right away.
@Test
public void testFilteringIterator() {
List<String> testList = Arrays.asList("abc", "bcd", "cde");
FilteringIterator<String> iterator = new FilteringIterator<String>(testList.iterator()) {
@Override
public boolean isValid(String object) {
return true;
}
};
ImmutableCollection<String> immutableCollection = ImmutableList.copyOf(iterator);
assertThat(immutableCollection.size(), is(3));
assertThat(immutableCollection.toString(), is("[abc, bcd, cde]"));
}
Original comment by [email protected]
on 27 Sep 2013 at 5:20
from cqengine.
Original comment by [email protected]
on 2 Oct 2013 at 9:36
- Changed state: Started
from cqengine.
Fixed in trunk, by applying your patch. Many thanks Gabe!
I will leave this issue open until included in the next binary release,
hopefully next week or so.
Original comment by [email protected]
on 2 Oct 2013 at 10:45
from cqengine.
Fixed in release 1.2.4. Many thanks!
Original comment by [email protected]
on 22 Nov 2013 at 10:01
- Changed state: Fixed
from cqengine.
Related Issues (20)
- most longest prefix value exist in the column value but it doesn't intersect with other columns values in the query that we need part of query retrieval HOT 7
- Support STRICT_REPLACEMENT in ObjectLockingIndexedCollection/ConcurrentIndexedCollection
- TransactionalIndexedCollection support for UniqueIndex is broken
- Support for attribute accessors for Java record type HOT 1
- Kryo generates InaccessibleObjectException - Make Dependencies "Java 17 compatible"
- Bug in AttributeOrdersComparator HOT 5
- Offheap cache visibility HOT 1
- Support for ANTLR 4.10.1 HOT 12
- Does it support SQL statistics queries HOT 3
- Thread blocked when using Materialized View Sort For the Longest Prefix for CSV that contain more than 11 K rows HOT 3
- Error while parsing SQL NOT LIKE query HOT 1
- Error while parsing SQL LIKE '%%%' query
- java.lang.IllegalStateException thrown in the getGenericType(Member member) method of AttributeBytecodeGenerator.java
- CQNGrammar Sources missing from master HOT 1
- What is use of sqlite-jdbc in cqengine HOT 2
- Index updated even though objectStore is not modified during IndexedCollection add HOT 2
- Does CQEngine compatible with Java 17 HOT 2
- Issues with Offheap Concurrent Index collection clear()
- Getting below error on jdk17.0.8.8.1 HOT 1
- Is CQEngine officially dead? HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cqengine.