bardackx / tiebreaker Goto Github PK
View Code? Open in Web Editor NEWJava library for sorting and picking by multiple criteria
License: MIT License
Java library for sorting and picking by multiple criteria
License: MIT License
This app doesn't seem to support String type. String type is a common type, so I think this library should support String type.
Exception in thread "main" java.lang.RuntimeException: Unsupported type class java.lang.String at com.bardackx.tiebreaker.MultiTypeComparator.lambda$new$16(MultiTypeComparator.java:69) at com.bardackx.tiebreaker.Tiebreaker.lambda$sort$4(Tiebreaker.java:75) at java.base/java.util.TimSort.countRunAndMakeAscending(TimSort.java:360) at java.base/java.util.TimSort.sort(TimSort.java:220) at java.base/java.util.Arrays.sort(Arrays.java:1515) at java.base/java.util.stream.SortedOps$SizedRefSortingSink.end(SortedOps.java:353) at java.base/java.util.stream.Sink$ChainedReference.end(Sink.java:258) at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:485) at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474) at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913) at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578) at com.bardackx.tiebreaker.Tiebreaker.sort(Tiebreaker.java:80) at com.bardackx.tiebreaker.Tiebreaker.sort(Tiebreaker.java:102) at com.bardackx.tiebreaker.Test.main(Test.java:27)
This little library is very useful to me, so can I contribute to this library?
Because this library now supports sorting multiple fields like sorting in SQL. But it doesn't support null sort like Database. I believe it should support null sort.
public static void main(String[] args) {
List<Account> accounts = new ArrayList<>();
Account account = new Account();
account.setNumber(null);
account.setId(1L);
Account account1 = new Account();
account1.setNumber(50);
account1.setId(1L);
accounts.add(account);
accounts.add(account1);
Tiebreaker<Account> tiebreaker = new Tiebreaker<>();
tiebreaker.ascending(Account::getId);
tiebreaker.ascending(Account::getNumber);
List<Account> sorted = tiebreaker.sort(accounts);
System.out.println(sorted);
}
Exception in thread "main" java.lang.NullPointerException
at com.bardackx.tiebreaker.Tiebreaker.lambda$sort$4(Tiebreaker.java:78)
at java.base/java.util.TimSort.countRunAndMakeAscending(TimSort.java:360)
at java.base/java.util.TimSort.sort(TimSort.java:220)
at java.base/java.util.Arrays.sort(Arrays.java:1515)
at java.base/java.util.stream.SortedOps$SizedRefSortingSink.end(SortedOps.java:353)
at java.base/java.util.stream.Sink$ChainedReference.end(Sink.java:258)
at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:485)
at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913)
at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578)
at com.bardackx.tiebreaker.Tiebreaker.sort(Tiebreaker.java:84)
at com.bardackx.tiebreaker.Tiebreaker.sort(Tiebreaker.java:106)
at com.bardackx.tiebreaker.App.main(App.java:32)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.