GithubHelp home page GithubHelp logo

tiebreaker's People

Contributors

bardackx avatar dependabot[bot] avatar

Stargazers

 avatar

Watchers

 avatar

tiebreaker's Issues

Unsupported type class java.lang.String

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?

java.lang.NullPointerException if the value is null

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)

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.