Comments (5)
Seems to be fixed
from paguro.
This unit test passes:
@Test public void testMutable() {
List<Integer> control = new ArrayList<>();
MutList<Integer> test = PersistentVector.emptyMutable();
final int SEVERAL = 2000; // more than 1024 so 3 levels deep.
for (int i = 0; i < SEVERAL; i++) {
control.add(i);
test.append(i);
assertEquals(control.size(), test.size());
}
for (int i = 0; i < SEVERAL; i++) {
assertEquals(control.get(i), test.get(i));
}
for (int i = 0; i < SEVERAL; i++) {
control.set(i, i + 10);
test.replace(i, i + 10);
assertEquals(control.size(), test.size());
assertEquals(control, test);
}
Can you alter it to make it fail? If you can do that, you don't need to answer any of my other questions. Otherwise:
If I understand what I'm looking at in your image, you have a mutable vector with a list as the first element and Doubles or Floats as the other visible elements. You just called replace with object id=314 and idx=1 and it looks like it put object id=314 (-92.4031) at index 1 and is ready to return the correctly mutated-in-place vector.
Questions about your example:
- What was at index 1 before?
- What was your expected result, vs. the actual?
- Why is there a List at index 0 when everything else in the vector looks like double? I don't use a lot of Heterogeneous vectors, so I guess this is more of a chatty question than troubleshooting.
Questions about reproducing this issue:
- How big a vector do you need to see the problem?
- Does it happen with homogeneous vectors, or just heterogeneous ones?
from paguro.
Seems to be a problem with the MutVector#replace()
and call of MutVector#editableArrayFor()
method.
Example for 3.6.0 version from Maven Central:
import org.organicdesign.fp.StaticImports;
import org.organicdesign.fp.collections.ImList;
import org.organicdesign.fp.collections.MutList;
public class PersistentVectorTest {
public static void main(String[] args) {
ImList<String> v = StaticImports.vec("0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10",
"11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25",
"26", "27", "28", "29", "30", "31", "32", "33", "34", "35", "36", "37", "38", "39", "40",
"41", "42", "43", "44", "45", "46", "47", "48", "49", "50", "51", "52", "53", "54", "55",
"56", "57", "58", "59", "60", "61", "62", "63", "64", "65", "66", "67", "68", "69", "70",
"71", "72", "73", "74", "75", "76", "77", "78", "79", "80", "81", "82", "83", "84", "85",
"86", "87", "88", "89", "90", "91", "92", "93", "94", "95", "96", "97", "98", "99");
MutList<String> m = v.mutable();
m.replace(0, "bug");
System.out.println(m.get(0).toString());
}
}
from paguro.
Thanks for finding this bug! I will fix, but maybe not until next weekend.
from paguro.
Thank you so much! This should be fixed in 3.7.0 which I just released. If you get a chance to test it, please leave a comment here and I'll close the issue.
from paguro.
Related Issues (20)
- More Benchmarks vs. pCollections (was: incorrect comparison with pCollections) HOT 5
- tag for 3.0.16? HOT 6
- Findbugs reports lots of issues HOT 2
- Support split(0) and split(size) HOT 6
- No way to iterate over maps without allocation HOT 2
- Concatenating RrbTree's with different element types gives ArrayStoreException HOT 5
- Remove usages of Array.newInstance() to enable native compilation HOT 7
- Possible bug in immutable RRB tree implementation HOT 12
- Confusing comment in RrbTree implementation HOT 2
- get fails for some indexes after joining two RrbTree vectors of certain sizes HOT 1
- Support Request: Creating a PersistentVector HOT 1
- Support Request: Threadsafety of PersistentHashMap HOT 11
- Make map creation less verbose HOT 2
- How to use Paguro with Java stream? HOT 1
- Collector implementations of the Paguro collections
- ImList, MutList - example for best practice of inserting an element before an existing element HOT 3
- ClassCastException after updating from 3.6.0 to 3.7.1 HOT 1
- Best practice for "inplace" sort() method on MutRrbt HOT 2
- Lazy/non-lazy concat() in PersistentHashSet versus PersistentVector 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 paguro.