eclipse / eclipse-collections

Eclipse Collections is a collections framework for Java with optimized data structures and a rich, functional and fluent API.
http://www.eclipse.org/collections
2.42k stars 604 forks source link

Optimized ImmutableArrayList #1644

Closed prithviraj2609 closed 1 month ago

prithviraj2609 commented 1 month ago

Have updated the methods takeWhile() and dropWhile() in the class ImmutableArrayList

prithviraj2609 commented 1 month ago

Hello @nikhilnanivadekar,

Good Morning ! Just trying to understand if this issue can be assigned to me. I saw it open as "good first issue". not sure if the issue has already been solved The Issue was "Optimize ImmutableArrayList.takeWhile() and dropWhile() for small lists."

motlin commented 1 month ago

The unit tests are failing - the implementation of dropWhile looks like what I'd expect, but the implementation of takeWhile is now broken.

02:47:02:201 [ERROR] Tests run: 172, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.067 s <<< FAILURE! -- in org.eclipse.collections.impl.list.immutable.ImmutableArrayListTest
02:47:02:201 [ERROR] org.eclipse.collections.impl.list.immutable.ImmutableArrayListTest.takeWhile -- Time elapsed: 0.003 s <<< FAILURE!
java.lang.AssertionError: expected:<[1]> but was:<[2, 3]>
    at org.eclipse.collections.impl.list.immutable.AbstractImmutableListTestCase.takeWhile(AbstractImmutableListTestCase.java:574)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
motlin commented 1 month ago

The commit message could mention the issue to automatically link them up. Something like Optimize ImmutableArrayList.takeWhile() and dropWhile() for small lists. Fixes #1640

prithviraj2609 commented 1 month ago

The unit tests are failing - the implementation of dropWhile looks like what I'd expect, but the implementation of takeWhile is now broken.

02:47:02:201 [ERROR] Tests run: 172, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.067 s <<< FAILURE! -- in org.eclipse.collections.impl.list.immutable.ImmutableArrayListTest
02:47:02:201 [ERROR] org.eclipse.collections.impl.list.immutable.ImmutableArrayListTest.takeWhile -- Time elapsed: 0.003 s <<< FAILURE!
java.lang.AssertionError: expected:<[1]> but was:<[2, 3]>
  at org.eclipse.collections.impl.list.immutable.AbstractImmutableListTestCase.takeWhile(AbstractImmutableListTestCase.java:574)
  at java.base/java.lang.reflect.Method.invoke(Method.java:566)

The tests are now passing with expected results

motlin commented 1 month ago

The tests are now passing with expected results

Thank you! Could you also squash the two commits into one?

prithviraj2609 commented 1 month ago

The tests are now passing with expected results

Thank you! Could you also squash the two commits into one?

I have squashed the two commits into one. I am also seeing the option Update Branch should I update the branch?

motlin commented 1 month ago

I have squashed the two commits into one.

Looks like there are still two commits.

Screenshot 2024-07-21 at 11 04 10 AM
prithviraj2609 commented 1 month ago

I have squashed the two commits into one.

Looks like there are still two commits.

Screenshot 2024-07-21 at 11 04 10 AM

Looks fine now, sorry for the mess

image