Re: Patterns for arrays of specific length

2019-03-04 Thread forax
- Mail original - > De: "Tagir Valeev" > À: "Remi Forax" > Cc: "amber-spec-experts" > Envoyé: Lundi 4 Mars 2019 10:13:40 > Objet: Re: Patterns for arrays of specific length > Hello! > >> Arrays.stream(resolveResu

Re: Patterns for arrays of specific length

2019-03-04 Thread Tagir Valeev
Hello! > Arrays.stream(resolveResults).findFirst().filter(ResolveResult::isValidResult).map(ResolveResult::getElement).orElse(null) This is obviously wrong: we need to return non-null result only if there's exactly one resolve result. As IDE we need to support incorrect code, in particular where

Re: Patterns for arrays of specific length

2019-03-04 Thread Remi Forax
"Brian Goetz" > À: "Tagir Valeev" > Cc: "amber-spec-experts" > Envoyé: Lundi 4 Mars 2019 08:34:46 > Objet: Re: Patterns for arrays of specific length > In general, there’s a duality between the ways in which we construct > composites > and the w

Re: Patterns for arrays of specific length

2019-03-04 Thread Remi Forax
Hi Tagir, - Mail original - > De: "Tagir Valeev" > À: "amber-spec-experts" > Envoyé: Lundi 4 Mars 2019 04:30:09 > Objet: Patterns for arrays of specific length > Hello! > > In intellij IDEA code we often see snippets like this: > > fina

Re: Patterns for arrays of specific length

2019-03-03 Thread Brian Goetz
In general, there’s a duality between the ways in which we construct composites and the way we deconstruct them. There’s an obvious duality between constructor and deconstructor patterns; between static factories and static patterns, etc. For structural composites, the obvious place to start

Patterns for arrays of specific length

2019-03-03 Thread Tagir Valeev
Hello! In intellij IDEA code we often see snippets like this: final ResolveResult[] resolveResults = multiResolve(false); return resolveResults.length == 1 && resolveResults[0].isValidResult() ? resolveResults[0].getElement() : null; I wonder if special kind of patterns to cover such case