Create a compareTo to a Generic Class that Implements Comparable

前端 未结 6 886
野趣味
野趣味 2020-12-31 01:29

I have a Generic Class with two type variables, which implements java.lang.Comparable.

public class DoubleKey implements Comparable

        
6条回答
  •  旧时难觅i
    2020-12-31 01:54

    As is often the case, there exists a library that can solve your problem: Apache Commons lang3. I often use Pair instances as keys. They implement Comparable.

提交回复
热议问题