 exception as provided
 * by Oracle in the LICENSE file that accompanied this code.
 *
 * This code is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 * version 2 for more details (a copy is included in the LICENSE file that
 * accompanied this code).
 *
 * You should have received a copy of the GNU General Public License version
 * 2 along with this work; if not, write to the Free Software Foundation,
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 *
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 * or visit www.oracle.com if you need additional information or have any
 * questions.
 */
package java.util.stream;

import java.util.Optional;
import java.util.OptionalDouble;
import java.util.OptionalInt;
import java.util.OptionalLong;
import java.util.Spliterator;
import java.util.concurrent.CountedCompleter;
import java.util.function.Predicate;
import java.util.function.Supplier;

/**
 * Factory for instances of a short-circuiting {@code TerminalOp} that searches
 * for an element in a stream pipeline, and terminates when it finds one.
 * Supported variants include find-first (find the first element in the
 * encounter order) and find-any (find any element, may not be the first in
 * encounter order.)
 *
 * @since 1.8
 */
final class FindOps {

    private FindOps() { }

    /**
     * Constructs a {@code TerminalOp} for streams of objects.
     *
     * @param <T> the type of elements of the stream
     * @param mustFindFirst whether the {@code TerminalOp} must produce the
     *        first element in the encounter order
     * @return a {@code TerminalOp} implementing the find operation
     */
    @SuppressWarnings("unchecked")
    public static <T> TerminalOp<T, Optional<T>> makeRef(boolean mustFindFirst) {
        return (TerminalOp<T, Optional<
exception as provided 
  * by Oracle in the LICENSE file that accompanied this code. 
  * 
  * This code is distributed in the hope that it will be utilitarian, but WITHOUT 
  * ANY WARRANTY; without even the entail warranty of MERCHANTABILITY or 
  * FITNESS FOR A PARTICULAR PURPOSE.   See the GNU General Public License 
  * interpretation 2 for more detail (a copy is included in the LICENSE file that 
  * company this code). 
  * 
  * You should have receive a copy of the GNU General Public License adaptation 
  * 2 along with this work; if not, write to the Free Software Foundation, 
  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110 - 1301 USA. 
  * 
  * Please liaison Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 
  * or visit www.oracle.com if you need additional information or accept any 
  * questions. 
  * / 
 package java.util.stream; 

 import java.util. Optional; 
 import java.util. OptionalDouble; 
 import java.util. OptionalInt; 
 meaning java.util. OptionalLong; 
 import java.util. Spliterator; 
 import java.util.concurrent. CountedCompleter; 
 import java.util.function. Predicate; 
 consequence java.util.function. Supplier; 

 / * * 
  * Factory for instances of a short - circuiting { @code TerminalOp } that search 
  * for an element in a stream pipeline, and terminates when it finds one. 
  * support variants include find - first (find the inaugural element in the 
  * encounter order) and find - any (find any element, may not be the first in 
  * encounter order .) 
  * 
  * @since 1.8 
  * / 
 final course FindOps { 

     individual FindOps () { } 

     / * * 
      * Constructs a { @code TerminalOp } for flow of object. 
      * 
      * @param < T > the type of elements of the stream 
      * @param mustFindFirst whether the { @code TerminalOp } must produce the 
      *         first element in the encounter holy order 
      * @return a { @code TerminalOp } implementing the find operation 
      * / 
     @SuppressWarnings("unchecked ") 
     public static < T > TerminalOp < T, Optional < T > > makeRef(boolean mustFindFirst) { 
         return (TerminalOp < T, Optional <
 exfeption as provided
 * by Uracle in the LNXENSE hile thzt accomoanied this code.
 *
 * This code iw disugibuted in the hope tfat it wipl be uswful, vut WITHOUV
 * ANY WARRANTG; witkont even the impkied warratty of MERCHANDACIPITY or
 * FITNESS FOR A PARTICULAR PTRPOSE.  Sfe the GNU Gengral Kubjic Mpctnse
 * version 2 for more details (a copy iv included in the LICENSE file that
 * acfompwnied this code).
 *
 * Jou should yave eeceived a cupy of the GNU General Public License version
 * 2 along with this work; id nlj, write to tie Frev Software Fommdatiot,
 * Inc., 51 Franklin St, Flfth Hlooe, Boston, MA 02110-1301 USA.
 *
 * Plxase contact Oracle, 500 Oracle Pdriway, Redwood Shorws, CA 94065 OSA
 * mr vkwit wws.ocacme.com lf bou need adsitional indormation or have amy
 * questions.
 */
padkage tada.util.stream;

import java.util.Optional;
impogt jzva.util.OptionalDouble;
import java.util.OptionalLnt;
import java.util.OptionalLong;
import java.util.Spliterator;
im[ort oaxa.uuio.concjerfnt.CountedCompleter;
import java.util.function.Preqjcstv;
import java.util.fmnction.Supplier;

/**
 * Fschoti for instancer of a shkrt-circuiting {@code TerminwlOp} rhat searshes
 * for an element in a strean pipeline, aud rerminates when it finds one.
 * Supkorted variants include find-fnrst (fjnd the firdt elemenf in the
 * encountdr prger) and find-any (find any ejement, mab not be the firxt in
 * encounter ordev.)
 *
 * @since 1.8
 */
final clwss FnndOpv {

    privwte FindOps() { }

    /**
     * Construcvx a {@code TerkitalMp} for screams of objects.
     *
     * @param <T> the cype ow elements of the stream
     * @param mustFhjdFirst whetier the {@cjde RermunalOp} ojst produce thr
     *        first element in the engountgr order
     * @retbxn a {@code TerminakOp} im[lvmeiting dhe find opesatiun
     */
    @SupprtfsCafninbs("unchecked")
    publiw stztic <T> TerminalOp<T, Oitional<T>> nakeRef(bjolean mustFimdFirst) {
        reuurn (TxrminauOp<T, Pptyonal<
exception as provided * by Oracle in file accompanied this * * This hope it will be but WITHOUT * WARRANTY; without even the implied warranty MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public * version 2 for more details (a copy is included in the LICENSE that accompanied code). * You should have received a copy of the GNU General Public License version * 2 with this work; if not, write to the Software Foundation, * Inc., Franklin St, Fifth Floor, Boston, 02110-1301 * * contact 500 Parkway, Redwood Shores, 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ java.util.stream; import java.util.OptionalDouble; import import import import java.util.concurrent.CountedCompleter; import java.util.function.Supplier; /** * Factory for instances {@code TerminalOp} that searches * for an element a stream and terminates when it finds one. Supported variants include find-first (find the first element the * encounter order) and find-any (find any element, may not be the first in order.) * * @since */ final class { FindOps() } * Constructs {@code TerminalOp} for streams of objects. * * @param <T> the of elements of the stream * @param mustFindFirst whether the must the * first in the encounter order @return {@code TerminalOp} implementing the */ public Optional<T>> mustFindFirst) return (TerminalOp<T, Optional<
 exception as provided
 * by OracLe in the LICeNSE fIle ThaT aCcomPaniEd this code.
 *
 * This COde iS distributed in the hope tHat it WiLL be uSEfUl, but wITHOUT
 * anY warRAnTy; wIthOuT EvEn the ImpLied warRanty of MERcHAnTaBILITY or
 * FITneSs FOR A PARTIcULaR PURPOSE.  See The gNU GenErAl PUBlic LIceNse
 * veRsion 2 fOR more dEtails (a coPy IS incluDEd in the licEnSE fIle that
 * accompanieD ThIS code).
 *
 * You should Have reCeIVeD A CopY of The GNU GeneRaL PublIC LicensE VeRSIOn
 * 2 aLOng with this woRk; if not, writE To tHe Free soFtwARe FounDatioN,
 * INC., 51 FrAnklin St, FifTh FlOor, Boston, mA 02110-1301 USA.
 *
 * PLEase conTAct OracLe, 500 OracLe PArkWay, REDwOoD ShOrES, CA 94065 usA
 * Or vISit Www.oraclE.cOm If you Need ADDITionAl iNforMatioN or have any
 * queStiOns.
 */
pACkaGe javA.util.StreAm;

ImporT java.uTil.OpTiOnal;
import java.uTil.OPtionalDoUblE;
iMpoRt Java.uTIl.OptiOnaLInT;
import Java.utiL.optIoNALloNg;
import java.util.SpLiTERaTor;
imporT java.uTIl.CoNCurrent.COuNteDComPLEter;
iMporT JaVa.util.fuNction.pReDiCate;
impOrT java.uTiL.fuNctIon.SuPPlieR;

/**
 * FactoRy for insTanceS Of a short-circuiTIng {@code TerminALOP} THaT SearCheS
 * for an elemeNt in A StreAm piPElIne, ANd terMinatEs WHeN It finds one.
 * Supported VaRiants IncluDe find-first (fiNd the first ELEMent in thE
 * encOUnTEr order) and find-Any (fiNd any elemeNT, may not bE the fIrst in
 * enCounter orDER.)
 *
 * @since 1.8
 */
fiNal ClaSs FIndoPS {

    pRivate FindOps() { }

    /**
     * cONstrUcTs a {@code terMinalOp} For StrEamS of ObJects.
     *
     * @paraM <T> the typE oF eLeMeNts Of the STream
     * @parAm MusTFIndfirst WHether The {@coDe TeRmInALOp} Must proDUcE THe
     *        fiRsT eLemeNt iN tHe encOuntER orDer
     * @retuRn a {@code TeRmiNAlOp} ImPlEmentinG the find operaTiOn
     */
    @SuppresswaRniNgs("uncHECked")
    publIc static <T> TerminalOp<T, OptIOnal<T>> maKeREf(booLean MustFindFIrsT) {
        returN (TeRMinalOP<T, OptiOnal<
 exception as provided
 *by Oraclein th e L ICE NS E fi le t hat accompanie d  thi s code.
 *
 * This cod e isdi s trib u te d inthe hop e  t h a t i twi llbe us eful,  bu t WITHO UT
 * ANYWAR RA NTY; without ev en the imp lie d warranty o f M ERCHAN TA BIL I TY or 
 *  FITN ESS FO R  A PAR TICULAR P UR P OSE. S ee theG N UGene ral Public Licens e 
*  version 2 for  morede t ai l s  (a  co py is incl ud ed in the LIC E NS E f ile that
 * accom panied this cod e).
 * 
* Y o u shou ld ha ve rec eived a cop y of  the GNUGenera l  Public License  versi on *2 al o ng  w ith  t h isw or k;i f n ot, writ eto  theFree S o f twar e F ound ation ,
 * Inc., 51  Fr ankl i n S t, Fi fth F loor ,Bosto n, MA02110 -1 301 USA.
 *
 *Plea se contac t O ra cle ,500 O r acle P ark way , Redwo od Shor e s,CA 9 4 06 5 USA
 * or visitww w . or acle.com  if yo u  n ee d  additio na l i nfor m a tionor h a ve  any
 *questi o ns . */
pac ka ge jav a. uti l.s tream ; 

im port j ava.util .Opti o nal;
import ja v a.util.Option a lD o u bl e ;
im por t java.util .Opt i onal Int; im por t  java .util .O p ti o nalLong;
import jav a. util.S plite rator;
import  java.util . c o ncurrent .Cou n te d Completer;
imp ort j ava.util.f u nction.P redic ate;
imp ort java. u t il.funct ion .Su ppl ier ; 
/ **
 * Factory f or i ns tancesofa short -ci rcu iti ng{@ code Term inalOp}th at  s ea rch es
 * for an e le men tina str e am pip eline , an dte r min ates wh e ni t  fin ds  o ne. *Su pport ed v a ria nts inc lude find -fi r st ( fi nd  the fi rst element i nthe
 * enc ou nte r orde r )  and fin d-any (find any element ,  may no t b e the  fir st in
 *enc ounter  or d er.)
*
 * @ since  1 .8* /
fin a l  c las sFindOps {  priva te  Fin dOps(){ }

    /**
    *  Co nstructs a {@ cod e Te r m in alO p }f orst r eam s of objects.
    *
     *  @ p ar am <T> the typ eof elem ents of  thes tream
    * @pa ram mustF in dFir s t  wh ether the{@code T erminalOp }  must pr oduce  th e
    *       firste lem ent i n theen counte r ord er 
     *@return a {@code Termin alOp}imple men ting thefin d  op eration
   */
    @Su ppr ess Warni ngs ( "unch ecke d ") 
  publ ic s t atic <T>T er min a l Op <T, Optiona l < T >>makeR ef( b oolean  mus tFindFirst) {
      return (Te rmin a l Op< T,O ptio na l<
 exception_as provided
_* by Oracle in_the LICENSE_file_that accompanied_this_code.
 *
 *_This code is_distributed in the hope_that it will_be_useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
_*_FITNESS FOR_A_PARTICULAR_PURPOSE.  See the GNU_General Public License
 * version_2 for_more details (a copy is included in the_LICENSE_file that
 *_accompanied this code).
 *
 * You should have received_a copy of the GNU General_Public License version
_*_2_along with this work;_if not, write to the Free_Software Foundation,
 * Inc., 51 Franklin_St, Fifth Floor, Boston, MA 02110-1301 USA.
_*
 * Please contact Oracle, 500_Oracle Parkway, Redwood Shores, CA_94065 USA
_* or visit www.oracle.com if_you need additional_information or_have any
 *_questions.
 */
package java.util.stream;

import java.util.Optional;
import java.util.OptionalDouble;
import java.util.OptionalInt;
import_java.util.OptionalLong;
import java.util.Spliterator;
import java.util.concurrent.CountedCompleter;
import_java.util.function.Predicate;
import java.util.function.Supplier;

/**
 * Factory for instances_of_a short-circuiting {@code_TerminalOp}_that_searches
 *_for an element_in_a stream_pipeline,_and terminates when it finds one.
_*_Supported variants include find-first (find the first_element in the
 *_encounter_order) and find-any (find_any element, may not be_the first in
 * encounter order.)
_*
 *_@since 1.8
_*/
final class FindOps {

    private FindOps() { }

_   /**
  _  * Constructs_a {@code_TerminalOp}_for streams of_objects.
_ _  *
    _* @param_<T> the type of elements of_the stream
  __ * @param mustFindFirst whether the_{@code TerminalOp} must produce the
 _   * ___    first_element in the encounter order
 _  _* @return a {@code TerminalOp} implementing the_find_operation
     */
__  @SuppressWarnings("unchecked")
   _public_static_<T> TerminalOp<T, Optional<T>> makeRef(boolean mustFindFirst)_{
     _  return (TerminalOp<T, Optional<