Comments (3)
There were some problems in Kotlin 1.0.3 handling this situation, but thanks to @dzharkov they all are fixed now in master branch and those fixes might already be backported to 1.0.x branch.
So currently koltinx.collections.immutable could be compiled only with the fresh Kotlin build, but later we plan to switch to more stable compiler version, like 1.1-M2 or even 1.0.4.
We're aware that our modification methods hide the methods of java.util.Collection
with the same name, but since it's allowed by JVM we do not expect it would cause problems when being used from Kotlin.
And our tests also show these immutable collections could be used from Java, see ImmutableListJavaTest.java for example.
If you have a concrete example where such name clash would cause problems, please share it.
from kotlinx.collections.immutable.
I could imagine two situations where the name clash could have consequences.
First is rather interesting effect, though unintended: one cannot implement both MutableCollection
and ImmutableCollection
in the same class. Though it seems not so bad, considering such implementation makes no sense.
Second is like the first one but from Java side: an ImmutableCollection
could not be implemented in Java, because it would ultimately conflict with the java.util.Collection
interface which has all methods as MutableCollection
in Kotlin. This is a problem, however it can be easily worked around by implementing such collections in Kotlin :)
from kotlinx.collections.immutable.
Okay, so it is a deliberate decision. Seems legit.
one cannot implement both MutableCollection and ImmutableCollection in the same class. Though it seems not so bad, considering such implementation makes no sense.
Actually, it may well make sense. There are data structures that can be an efficient implementation of both an ephemeral and persistent collection with useful properties, e.g. a segment tree or an implicit treap. It is all a matter of usage pattern, not the structures themselves.
But, of course, you can always resolve this problem using delegation.
Second is like the first one but from Java side: an ImmutableCollection could not be implemented in Java
Actually, it seems that you can as long as you don't try to override the Collection's base methods. I just tried it. Still don't get how it's possible (java 8 default methods hidden somewhere in Kotlin's Collection interface?).
from kotlinx.collections.immutable.
Related Issues (20)
- Dead Repo HOT 2
- PersistentList is missing a subList that returns a new PersistentList (currently returns ImmutableList) HOT 1
- Update kotlin version to 1.9.20 HOT 3
- Implementation methods inherited from `kotlin-stdlib` `Abstract[x]` are not visible in interfaces HOT 2
- PeristentHashMap.values creates a new instance of `PersistentHashMapValues` on each call HOT 3
- Consider `addAll` special cases HOT 1
- concurrentList.toPersistentList or concurrentMap.toPersistentMap is incorrectly implemented HOT 1
- Provide module-info descriptor for java 9 and later HOT 7
- WASM support HOT 3
- Add extension functions to convert Array to persistent collections
- Explicit API mode? HOT 5
- Introduce Binary compatibility validator to track API changes
- Add documentation for immutable adapters HOT 1
- Compiler warning: Exported declaration uses non-exportable parameter type HOT 4
- Is the Android fast iteratable methods supported? HOT 1
- Map, Filter, etc. operations on an ImmutableList should return another ImmutableList HOT 1
- No orEmpty function for ImmutableList?
- Add explanation about persistent collection to doc
- Road to Beta HOT 1
- Setup commitStatusPublisher to publish CI run results to PRs
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 kotlinx.collections.immutable.