Giter VIP home page Giter VIP logo

dexx's People

Contributors

0xflotus avatar ajs6f avatar andrewoma avatar markuskull avatar ptitjes avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dexx's Issues

OSGi metadata?

It would be useful for the Dexx artifacts to include OSGi metadata, and the cost is very low. I include a PR that does the job for the Java artifact. Thanks!

New release to Maven Central?

The version of Dexx Collections available from Maven Central is 0.2, but it seems that there have been several moves ahead since 2014 (when that Maven Central release was made). Is it possible to please have a more recent release supplied? Thanks!

"Defect: unexpected empty zipper while computing range" for some range queries

import com.github.andrewoma.dexx.collection.TreeMap;

public class Test {
	public static void main(String[] args) {
		TreeMap<Integer, String> map = new TreeMap<>();
		map = map.put(new Integer(0), "0");
		map = map.put(new Integer(50), "50");		
		System.out.println(map.to(new Integer(101), false).values());
	}	
}```

This little harmless looking piece of code generates an exception:
java.lang.RuntimeException: Defect: unexpected empty zipper while computing range
	at com.github.andrewoma.dexx.collection.internal.redblack.RedBlackTree.findDepth(RedBlackTree.java:514)
	at com.github.andrewoma.dexx.collection.internal.redblack.RedBlackTree.findDepth(RedBlackTree.java:517)
	at com.github.andrewoma.dexx.collection.internal.redblack.RedBlackTree.rebalance(RedBlackTree.java:533)
	at com.github.andrewoma.dexx.collection.internal.redblack.RedBlackTree.doUntil(RedBlackTree.java:390)
	at com.github.andrewoma.dexx.collection.internal.redblack.RedBlackTree.until(RedBlackTree.java:128)
	at com.github.andrewoma.dexx.collection.TreeMap.to(TreeMap.java:169)

Note that adding another pair, adding the values in a different order or querying for a key that is available prevents the exception from being thrown.

Please fix

Set< A > Does not use .equals as comments contend.

I had an object consisting of three scalar values the .equals() method used the equals() method on these for comparison.

The set continued to contain duplicates. Implementing hashCode() with respect to the scalar values was the only solution.

Add method count for Android developers

Android has a 64k method limit, so a lot of Android developers take method count into consideration when choosing libraries.

As this library appears to be pretty compact (especially compared to some of the bloat-ridden alternatives like Guava) highlighting the method count might encourage more use by Android developers.

Documentation request

Is there anyway to add benchmarks of what Dexx's performance is compared to Java acting in the same way? I've been using the java.util collections in an immutable fashion for a while, and the most telling benchmark in there for immutable use of the java collections is prepending elements to a list.

Also, a side note, it may be nice to have Sets.collector(), Lists.collector() etc to work with Java 1.8's collection streaming interface; I've done a couple of trivial ones that I might be able to make a pull request for when I finish with the project I'm currently working on (scheduled for delivery mid-to-late March).

Support null elements in sets

Hello,

I noticed that sets don't support null elements.

java.lang.NullPointerException
	at com.github.andrewoma.dexx.collection.internal.hashmap.CompactHashMap.put(CompactHashMap.java:69)
	at com.github.andrewoma.dexx.collection.HashSet.add(HashSet.java:88)
	at com.github.andrewoma.dexx.collection.HashSet.add(HashSet.java:36)
	[...]
java.lang.NullPointerException
	at com.github.andrewoma.dexx.collection.internal.hashmap.CompactHashMap.put(CompactHashMap.java:69)
	at com.github.andrewoma.dexx.collection.HashSet.add(HashSet.java:88)
	at com.github.andrewoma.dexx.collection.Sets.copyOf(Sets.java:133)
	[...]

As there is no @NotNull annotation for it, I assume it is a bug.

README provides Maven instructions instead of Gradle

* Dexx is currently built with maven. Use mvn install to build and install into your local repository.
should become
* Dexx is currently built with gradle. Use ./gradlew install to build and install into your local repository.

Not sure what should become of this block:

* By default, a quick version of tests are run. Getting better test coverage of `Vectors` requires large
  collections. To run tests with complete coverage use: `mvn -Ddexx.test.mode=COMPLETE -P cobertura clean cobertura:cobertura`
* To run the benchmarks, use `mvn -Ddexx.test.mode=BENCHMARK test` (results are lines starting with BENCHMARK).

Constructing a map from java.util.Map

The following does not work:

java.util.Map<String, Integer> javaMap = new java.util.HashMap<String, Integer>();
Map<String, Integer> immutableMap = Maps.copyOf(javaMap.entrySet());

Compile error:

build/plugins/java/Dexx.java:20: error: no suitable method found for copyOf(java.util.Map<String,Integer>)
Map<String, Integer> immutableMap = Maps.copyOf(javaMap);
                                        ^
    method Maps.<K#1,V#1>copyOf(Iterable<Pair<K#1,V#1>>) is not applicable
      (cannot infer type-variable(s) K#1,V#1
        (argument mismatch; java.util.Map<String,Integer> cannot be converted to Iterable<Pair<K#1,V#1>>))
    method Maps.<K#2,V#2>copyOf(Iterator<Pair<K#2,V#2>>) is not applicable
      (cannot infer type-variable(s) K#2,V#2
        (argument mismatch; java.util.Map<String,Integer> cannot be converted to Iterator<Pair<K#2,V#2>>))
    method Maps.<K#3,V#3>copyOf(Pair<K#3,V#3>[]) is not applicable
      (cannot infer type-variable(s) K#3,V#3
        (argument mismatch; java.util.Map<String,Integer> cannot be converted to Pair<K#3,V#3>[]))
  where K#1,V#1,K#2,V#2,K#3,V#3 are type-variables:
    K#1 extends Object declared in method <K#1,V#1>copyOf(Iterable<Pair<K#1,V#1>>)
    V#1 extends Object declared in method <K#1,V#1>copyOf(Iterable<Pair<K#1,V#1>>)
    K#2 extends Object declared in method <K#2,V#2>copyOf(Iterator<Pair<K#2,V#2>>)
    V#2 extends Object declared in method <K#2,V#2>copyOf(Iterator<Pair<K#2,V#2>>)
    K#3 extends Object declared in method <K#3,V#3>copyOf(Pair<K#3,V#3>[])
    V#3 extends Object declared in method <K#3,V#3>copyOf(Pair<K#3,V#3>[])

It would be nice to have a method in Maps that allows to construct a Map from a java.util.Map

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.