langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Operators.java
changeset 39806 d3a13ca6013e
parent 33018 9790ed482dd0
child 39920 4923274643f2
equal deleted inserted replaced
39678:5bf88dce615f 39806:d3a13ca6013e
     1 /*
     1 /*
     2  * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
   796                     .addBinaryOperator(BOOLEAN, BOOLEAN, BOOLEAN, bool_and),
   796                     .addBinaryOperator(BOOLEAN, BOOLEAN, BOOLEAN, bool_and),
   797             new BinaryBooleanOperator(Tag.OR)
   797             new BinaryBooleanOperator(Tag.OR)
   798                     .addBinaryOperator(BOOLEAN, BOOLEAN, BOOLEAN, bool_or));
   798                     .addBinaryOperator(BOOLEAN, BOOLEAN, BOOLEAN, bool_or));
   799     }
   799     }
   800 
   800 
       
   801     Symbol lookupBinaryOp(Predicate<Symbol> applicabilityTest) {
       
   802         return binaryOperators.values().stream()
       
   803                 .flatMap(List::stream)
       
   804                 .map(helper -> helper.doLookup(applicabilityTest))
       
   805                 .distinct()
       
   806                 .filter(sym -> sym != syms.noSymbol)
       
   807                 .findFirst().get();
       
   808     }
       
   809 
   801     /**
   810     /**
   802      * Complete the initialization of an operator helper by storing it into the corresponding operator map.
   811      * Complete the initialization of an operator helper by storing it into the corresponding operator map.
   803      */
   812      */
   804     @SafeVarargs
   813     @SafeVarargs
   805     private final <O extends OperatorHelper> void initOperators(Map<Name, List<O>> opsMap, O... ops) {
   814     private final <O extends OperatorHelper> void initOperators(Map<Name, List<O>> opsMap, O... ops) {