Path: csiph.com!eternal-september.org!feeder.eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail From: Eric Sosman Newsgroups: comp.lang.java.programmer Subject: Re: Compare generics (that are numbers) Date: Wed, 29 Jul 2020 13:48:28 -0400 Organization: A noiseless patient Spider Lines: 19 Message-ID: References: <87k0ym73id.fsf@munus.decebal.nl> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Wed, 29 Jul 2020 17:48:30 -0000 (UTC) Injection-Info: reader02.eternal-september.org; posting-host="a3ee00f188f14572f560164fde5a17e9"; logging-data="14090"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX184gEddLMMqIsaRXgZNrjRZ" User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 Cancel-Lock: sha1:xwwVLaGdImJ3H6+IMroNnuW8aT4= In-Reply-To: <87k0ym73id.fsf@munus.decebal.nl> Content-Language: en-US Xref: csiph.com comp.lang.java.programmer:39592 On 7/29/2020 11:19 AM, Cecil Westerhof wrote: > I have a class that starts with: > abstract class CalcValuesGeneric { > > E will be Integer, int, Float or float. (For now, but always a Number.) > What is the best way to determine which of the two is lower? Aside: How can you get `' to be `' or `'? Is that something new? I'm still on Java 8, but the JLS for 14 says "Seq is illegal, as primitive types cannot be type arguments." (4.5) Anyhow, could you use `CalcValueGeneric>' (double-check my syntax)? That would at least handle Integer/Integer and Float/Float, though it wouldn't help with Integer/Float. -- esosman@comcast-dot-net.invalid Donald Trump is a self-mad man. One hundred seventy-five days to go.