idx
int64
0
41.2k
question
stringlengths
73
5.81k
target
stringlengths
5
918
31,300
protected Map < String , String > prepareRequiredParameters ( final FunctionTemplate template , final BindingTemplate bindingTemplate ) throws MojoFailureException { info ( "" ) ; info ( PREPARE_PARAMS ) ; prepareFunctionName ( ) ; preparePackageName ( ) ; final Map < String , String > params = new HashMap < > ( ) ; pa...
region Prepare parameters
31,301
protected String substituteParametersInTemplate ( final FunctionTemplate template , final Map < String , String > params ) { String ret = template . getFiles ( ) . get ( "function.java" ) ; for ( final Map . Entry < String , String > entry : params . entrySet ( ) ) { ret = ret . replace ( String . format ( "$%s$" , ent...
region Substitute parameters
31,302
protected void saveNewFunctionToFile ( final String newFunctionClass ) throws Exception { info ( "" ) ; info ( SAVE_FILE ) ; final File packageDir = getPackageDir ( ) ; final File targetFile = getTargetFile ( packageDir ) ; createPackageDirIfNotExist ( packageDir ) ; saveToTargetFile ( targetFile , newFunctionClass ) ;...
region Save function to file
31,303
protected void createOrUpdateFunctionApp ( ) throws Exception { final FunctionApp app = getFunctionApp ( ) ; if ( app == null ) { createFunctionApp ( ) ; } else { updateFunctionApp ( app ) ; } }
region Create or update Azure Functions
31,304
protected Authenticated getAuthObjFromServerId ( final Settings settings , final String serverId ) { if ( StringUtils . isEmpty ( serverId ) ) { getLog ( ) . debug ( SERVER_ID_NOT_CONFIG ) ; return null ; } final Server server = Utils . getServer ( settings , serverId ) ; try { assureServerExist ( server , serverId ) ;...
Get Authenticated object by referencing server definition in Maven settings . xml
31,305
protected Authenticated getAuthObjFromFile ( final File authFile ) { if ( authFile == null ) { getLog ( ) . debug ( AUTH_FILE_NOT_CONFIG ) ; return null ; } if ( ! authFile . exists ( ) ) { getLog ( ) . error ( AUTH_FILE_NOT_EXIST + authFile . getAbsolutePath ( ) ) ; return null ; } try { final Authenticated auth = azu...
Get Authenticated object using file .
31,306
protected Authenticated getAuthObjFromAzureCli ( ) { try { final Azure . Configurable azureConfigurable = azureConfigure ( ) ; final Authenticated auth ; if ( isInCloudShell ( ) ) { getLog ( ) . info ( AUTH_WITH_MSI ) ; auth = azureConfigurable . authenticate ( new MSICredentials ( ) ) ; } else { getLog ( ) . info ( AU...
Get Authenticated object using authentication file from Azure CLI 2 . 0
31,307
protected ApplicationTokenCredentials getAppTokenCredentialsFromServer ( Server server ) { if ( server == null ) { return null ; } final String clientId = Utils . getValueFromServerConfiguration ( server , CLIENT_ID ) ; if ( StringUtils . isEmpty ( clientId ) ) { getLog ( ) . debug ( CLIENT_ID_NOT_CONFIG ) ; return nul...
Get ApplicationTokenCredentials from server definition in Maven settings . xml
31,308
@ FunctionName ( "EventHubTriggerJava" ) public void run ( @ EventHubTrigger ( name = "message" , eventHubName = "trigger" , connection = "CIEventHubConnection" , consumerGroup = "$Default" ) String message , @ EventHubOutput ( name = "result" , eventHubName = "output" , connection = "CIEventHubConnection" ) OutputBind...
This function will be invoked when an event is received from Event Hub .
31,309
public static Server getServer ( final Settings settings , final String serverId ) { if ( settings == null || StringUtils . isEmpty ( serverId ) ) { return null ; } return settings . getServer ( serverId ) ; }
Get server credential from Maven settings by server Id .
31,310
public static void assureServerExist ( final Server server , final String serverId ) throws MojoExecutionException { if ( server == null ) { throw new MojoExecutionException ( String . format ( "Server not found in settings.xml. ServerId=%s" , serverId ) ) ; } }
Assure the server with specified id does exist in settings . xml . It could be the server used for azure authentication . Or the server used for docker hub authentication of runtime configuration .
31,311
public static String getValueFromServerConfiguration ( final Server server , final String key ) { if ( server == null ) { return null ; } final Xpp3Dom configuration = ( Xpp3Dom ) server . getConfiguration ( ) ; if ( configuration == null ) { return null ; } final Xpp3Dom node = configuration . getChild ( key ) ; if ( ...
Get string value from server configuration section in settings . xml .
31,312
public static void copyResources ( final MavenProject project , final MavenSession session , final MavenResourcesFiltering filtering , final List < Resource > resources , final String targetDirectory ) throws IOException { for ( final Resource resource : resources ) { final String targetPath = resource . getTargetPath ...
Copy resources to target directory using Maven resource filtering so that we don t have to handle recursive directory listing and pattern matching . In order to disable filtering the filtering property is force set to False .
31,313
private void prepareJavaSERuntime ( final List < File > artifacts ) throws MojoExecutionException { final File artifact = getProjectJarArtifact ( artifacts ) ; if ( artifact == null ) { return ; } switch ( runtimeSetting . getOsEnum ( ) ) { case Windows : try { WebAppUtils . generateWebConfigFile ( artifact . getName (...
Rename project jar to app . jar for linux app service or generate web . config for windows javase app service
31,314
public void uploadDirectoryWithRetries ( final String ftpServer , final String username , final String password , final String sourceDirectory , final String targetDirectory , final int maxRetryCount ) throws MojoExecutionException { int retryCount = 0 ; while ( retryCount < maxRetryCount ) { retryCount ++ ; log . info...
Upload directory to specified FTP server with retries .
31,315
protected boolean uploadDirectory ( final String ftpServer , final String username , final String password , final String sourceDirectoryPath , final String targetDirectoryPath ) { log . debug ( "FTP username: " + username ) ; try { final FTPClient ftpClient = getFTPClient ( ftpServer , username , password ) ; log . in...
Upload directory to specified FTP server without retries .
31,316
protected void uploadDirectory ( final FTPClient ftpClient , final String sourceDirectoryPath , final String targetDirectoryPath , final String logPrefix ) throws IOException { log . info ( String . format ( UPLOAD_DIR , logPrefix , sourceDirectoryPath , targetDirectoryPath ) ) ; final File sourceDirectory = new File (...
Recursively upload a directory to FTP server with the provided FTP client object .
31,317
protected void uploadFile ( final FTPClient ftpClient , final String sourceFilePath , final String targetFilePath , final String logPrefix ) throws IOException { log . info ( String . format ( UPLOAD_FILE , logPrefix , sourceFilePath , targetFilePath ) ) ; final File sourceFile = new File ( sourceFilePath ) ; try ( fin...
Upload a single file to FTP server with the provided FTP client object .
31,318
private Element getMavenPluginElement ( ) { try { final Element pluginsRoot = document . getRootElement ( ) . element ( "build" ) . element ( "plugins" ) ; for ( final Element element : pluginsRoot . elements ( ) ) { final String groupId = XMLUtils . getChildValue ( "groupId" , element ) ; final String artifactId = XML...
get webapp maven plugin node from pom
31,319
private com . microsoft . applicationinsights . TelemetryConfiguration readConfigurationFromFile ( ) { final com . microsoft . applicationinsights . TelemetryConfiguration telemetryConfiguration = new com . microsoft . applicationinsights . TelemetryConfiguration ( ) ; final Map < String , String > channelProperties = ...
use ai sdk to read configuration file once the issue is fixed
31,320
private String readInstrumentationKeyFromConfiguration ( ) { try ( final InputStream inputStream = this . getClass ( ) . getClassLoader ( ) . getResourceAsStream ( CONFIGURATION_FILE ) ) { final String configuration = IOUtils . toString ( inputStream ) ; final Matcher matcher = INSTRUMENTATION_KEY_PATTERN . matcher ( c...
Get instrumentation key from ApplicationInsights . xml
31,321
protected Map < String , FunctionConfiguration > getFunctionConfigurations ( final AnnotationHandler handler , final Set < Method > methods ) throws Exception { info ( "" ) ; info ( GENERATE_CONFIG ) ; final Map < String , FunctionConfiguration > configMap = handler . generateConfigurations ( methods ) ; if ( configMap...
region Generate function configurations
31,322
protected void validateFunctionConfigurations ( final Map < String , FunctionConfiguration > configMap ) { info ( "" ) ; info ( VALIDATE_CONFIG ) ; if ( configMap . size ( ) == 0 ) { info ( VALIDATE_SKIP ) ; } else { configMap . values ( ) . forEach ( config -> config . validate ( ) ) ; info ( VALIDATE_DONE ) ; } }
region Validate function configurations
31,323
protected void copyJarsToStageDirectory ( ) throws IOException { final String stagingDirectory = getDeploymentStagingDirectoryPath ( ) ; info ( "" ) ; info ( COPY_JARS + stagingDirectory ) ; Utils . copyResources ( getProject ( ) , getSession ( ) , getMavenResourcesFiltering ( ) , getResources ( ) , stagingDirectory ) ...
region Copy Jars to stage directory
31,324
public String getAuthType ( ) { final AuthenticationSetting authSetting = getAuthenticationSetting ( ) ; if ( authSetting == null ) { return "AzureCLI" ; } if ( StringUtils . isNotEmpty ( authSetting . getServerId ( ) ) ) { return "ServerId" ; } if ( authSetting . getFile ( ) != null ) { return "AuthFile" ; } return "U...
Add AuthType ENUM and move to AzureAuthHelper .
31,325
public static SlidrInterface replace ( final View oldScreen , final SlidrConfig config ) { ViewGroup parent = ( ViewGroup ) oldScreen . getParent ( ) ; ViewGroup . LayoutParams params = oldScreen . getLayoutParams ( ) ; parent . removeView ( oldScreen ) ; final SliderPanel panel = new SliderPanel ( oldScreen . getConte...
Attach a slider mechanism to a fragment view replacing an internal view
31,326
public static License read ( final String license ) { final String trimmedLicense = license . trim ( ) ; if ( sLicenses . containsKey ( trimmedLicense ) ) { return sLicenses . get ( trimmedLicense ) ; } else { throw new IllegalStateException ( String . format ( "no such license available: %s, did you forget to register...
Get a license by name
31,327
public final Tuple4 < T1 , T2 , T3 , T4 > limit4 ( ) { return new Tuple4 < > ( v1 , v2 , v3 , v4 ) ; }
Limit this tuple to degree 4 .
31,328
public final Tuple5 < T1 , T2 , T3 , T4 , T5 > limit5 ( ) { return new Tuple5 < > ( v1 , v2 , v3 , v4 , v5 ) ; }
Limit this tuple to degree 5 .
31,329
public final Tuple6 < T1 , T2 , T3 , T4 , T5 , T6 > limit6 ( ) { return new Tuple6 < > ( v1 , v2 , v3 , v4 , v5 , v6 ) ; }
Limit this tuple to degree 6 .
31,330
public final Tuple7 < T1 , T2 , T3 , T4 , T5 , T6 , T7 > limit7 ( ) { return new Tuple7 < > ( v1 , v2 , v3 , v4 , v5 , v6 , v7 ) ; }
Limit this tuple to degree 7 .
31,331
public final Tuple10 < T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 > limit10 ( ) { return this ; }
Limit this tuple to degree 10 .
31,332
public final Tuple2 < Tuple0 , Tuple6 < T1 , T2 , T3 , T4 , T5 , T6 > > split0 ( ) { return new Tuple2 < > ( limit0 ( ) , skip0 ( ) ) ; }
Split this tuple into two tuples of degree 0 and 6 .
31,333
public final Tuple2 < Tuple1 < T1 > , Tuple5 < T2 , T3 , T4 , T5 , T6 > > split1 ( ) { return new Tuple2 < > ( limit1 ( ) , skip1 ( ) ) ; }
Split this tuple into two tuples of degree 1 and 5 .
31,334
public final Tuple2 < Tuple2 < T1 , T2 > , Tuple4 < T3 , T4 , T5 , T6 > > split2 ( ) { return new Tuple2 < > ( limit2 ( ) , skip2 ( ) ) ; }
Split this tuple into two tuples of degree 2 and 4 .
31,335
public final Tuple2 < Tuple6 < T1 , T2 , T3 , T4 , T5 , T6 > , Tuple0 > split6 ( ) { return new Tuple2 < > ( limit6 ( ) , skip6 ( ) ) ; }
Split this tuple into two tuples of degree 6 and 0 .
31,336
public final Tuple2 < Tuple9 < T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 > , Tuple2 < T10 , T11 > > split9 ( ) { return new Tuple2 < > ( limit9 ( ) , skip9 ( ) ) ; }
Split this tuple into two tuples of degree 9 and 2 .
31,337
public final Tuple2 < Tuple7 < T1 , T2 , T3 , T4 , T5 , T6 , T7 > , Tuple6 < T8 , T9 , T10 , T11 , T12 , T13 > > split7 ( ) { return new Tuple2 < > ( limit7 ( ) , skip7 ( ) ) ; }
Split this tuple into two tuples of degree 7 and 6 .
31,338
public final Tuple2 < Tuple8 < T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 > , Tuple5 < T9 , T10 , T11 , T12 , T13 > > split8 ( ) { return new Tuple2 < > ( limit8 ( ) , skip8 ( ) ) ; }
Split this tuple into two tuples of degree 8 and 5 .
31,339
public final Tuple2 < Tuple10 < T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 > , Tuple5 < T11 , T12 , T13 , T14 , T15 > > split10 ( ) { return new Tuple2 < > ( limit10 ( ) , skip10 ( ) ) ; }
Split this tuple into two tuples of degree 10 and 5 .
31,340
public final Tuple2 < Tuple11 < T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 > , Tuple4 < T12 , T13 , T14 , T15 > > split11 ( ) { return new Tuple2 < > ( limit11 ( ) , skip11 ( ) ) ; }
Split this tuple into two tuples of degree 11 and 4 .
31,341
public final Tuple2 < Tuple12 < T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 > , Tuple3 < T13 , T14 , T15 > > split12 ( ) { return new Tuple2 < > ( limit12 ( ) , skip12 ( ) ) ; }
Split this tuple into two tuples of degree 12 and 3 .
31,342
public final Tuple2 < Tuple13 < T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 > , Tuple2 < T14 , T15 > > split13 ( ) { return new Tuple2 < > ( limit13 ( ) , skip13 ( ) ) ; }
Split this tuple into two tuples of degree 13 and 2 .
31,343
public final Tuple2 < Tuple0 , Tuple5 < T1 , T2 , T3 , T4 , T5 > > split0 ( ) { return new Tuple2 < > ( limit0 ( ) , skip0 ( ) ) ; }
Split this tuple into two tuples of degree 0 and 5 .
31,344
public final Tuple2 < Tuple1 < T1 > , Tuple4 < T2 , T3 , T4 , T5 > > split1 ( ) { return new Tuple2 < > ( limit1 ( ) , skip1 ( ) ) ; }
Split this tuple into two tuples of degree 1 and 4 .
31,345
public final Tuple2 < Tuple2 < T1 , T2 > , Tuple3 < T3 , T4 , T5 > > split2 ( ) { return new Tuple2 < > ( limit2 ( ) , skip2 ( ) ) ; }
Split this tuple into two tuples of degree 2 and 3 .
31,346
public final Tuple2 < Tuple5 < T1 , T2 , T3 , T4 , T5 > , Tuple0 > split5 ( ) { return new Tuple2 < > ( limit5 ( ) , skip5 ( ) ) ; }
Split this tuple into two tuples of degree 5 and 0 .
31,347
public final Tuple2 < Tuple2 < T1 , T2 > , Tuple10 < T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 > > split2 ( ) { return new Tuple2 < > ( limit2 ( ) , skip2 ( ) ) ; }
Split this tuple into two tuples of degree 2 and 10 .
31,348
public final Tuple2 < Tuple3 < T1 , T2 , T3 > , Tuple9 < T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 > > split3 ( ) { return new Tuple2 < > ( limit3 ( ) , skip3 ( ) ) ; }
Split this tuple into two tuples of degree 3 and 9 .
31,349
public final Tuple2 < Tuple4 < T1 , T2 , T3 , T4 > , Tuple8 < T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 > > split4 ( ) { return new Tuple2 < > ( limit4 ( ) , skip4 ( ) ) ; }
Split this tuple into two tuples of degree 4 and 8 .
31,350
public final Tuple2 < Tuple5 < T1 , T2 , T3 , T4 , T5 > , Tuple7 < T6 , T7 , T8 , T9 , T10 , T11 , T12 > > split5 ( ) { return new Tuple2 < > ( limit5 ( ) , skip5 ( ) ) ; }
Split this tuple into two tuples of degree 5 and 7 .
31,351
public final Tuple2 < Tuple6 < T1 , T2 , T3 , T4 , T5 , T6 > , Tuple6 < T7 , T8 , T9 , T10 , T11 , T12 > > split6 ( ) { return new Tuple2 < > ( limit6 ( ) , skip6 ( ) ) ; }
Split this tuple into two tuples of degree 6 and 6 .
31,352
public final Tuple12 < T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 > limit12 ( ) { return this ; }
Limit this tuple to degree 12 .
31,353
public final Tuple2 < Tuple2 < T1 , T2 > , Tuple5 < T3 , T4 , T5 , T6 , T7 > > split2 ( ) { return new Tuple2 < > ( limit2 ( ) , skip2 ( ) ) ; }
Split this tuple into two tuples of degree 2 and 5 .
31,354
public final Tuple2 < Tuple0 , Tuple3 < T1 , T2 , T3 > > split0 ( ) { return new Tuple2 < > ( limit0 ( ) , skip0 ( ) ) ; }
Split this tuple into two tuples of degree 0 and 3 .
31,355
public final Tuple2 < Tuple2 < T1 , T2 > , Tuple1 < T3 > > split2 ( ) { return new Tuple2 < > ( limit2 ( ) , skip2 ( ) ) ; }
Split this tuple into two tuples of degree 2 and 1 .
31,356
public final Tuple2 < Tuple3 < T1 , T2 , T3 > , Tuple0 > split3 ( ) { return new Tuple2 < > ( limit3 ( ) , skip3 ( ) ) ; }
Split this tuple into two tuples of degree 3 and 0 .
31,357
public final Tuple2 < Tuple0 , Tuple4 < T1 , T2 , T3 , T4 > > split0 ( ) { return new Tuple2 < > ( limit0 ( ) , skip0 ( ) ) ; }
Split this tuple into two tuples of degree 0 and 4 .
31,358
public final Tuple2 < Tuple1 < T1 > , Tuple3 < T2 , T3 , T4 > > split1 ( ) { return new Tuple2 < > ( limit1 ( ) , skip1 ( ) ) ; }
Split this tuple into two tuples of degree 1 and 3 .
31,359
public final Tuple2 < Tuple4 < T1 , T2 , T3 , T4 > , Tuple0 > split4 ( ) { return new Tuple2 < > ( limit4 ( ) , skip4 ( ) ) ; }
Split this tuple into two tuples of degree 4 and 0 .
31,360
public final < U4 > Tuple4 < T1 , T2 , T3 , U4 > map4 ( Function < ? super T4 , ? extends U4 > function ) { return Tuple . tuple ( v1 , v2 , v3 , function . apply ( v4 ) ) ; }
Apply attribute 4 as argument to a function and return a new tuple with the substituted argument .
31,361
public final Tuple4 < T13 , T14 , T15 , T16 > skip12 ( ) { return new Tuple4 < > ( v13 , v14 , v15 , v16 ) ; }
Skip 12 degrees from this tuple .
31,362
public final Tuple9 < T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 > limit9 ( ) { return this ; }
Limit this tuple to degree 9 .
31,363
public final Tuple2 < Tuple1 < T1 > , Tuple7 < T2 , T3 , T4 , T5 , T6 , T7 , T8 > > split1 ( ) { return new Tuple2 < > ( limit1 ( ) , skip1 ( ) ) ; }
Split this tuple into two tuples of degree 1 and 7 .
31,364
public final Tuple8 < T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 > limit8 ( ) { return this ; }
Limit this tuple to degree 8 .
31,365
public < K > StreamEx < T > filterBy ( Function < ? super T , ? extends K > mapper , K value ) { return value == null ? filter ( t -> mapper . apply ( t ) == null ) : filter ( t -> value . equals ( mapper . apply ( t ) ) ) ; }
Returns a stream consisting of the elements of this stream for which the supplied mapper function returns the given value .
31,366
@ SuppressWarnings ( "unchecked" ) public < A > A [ ] toArray ( Class < A > elementClass ) { return stream ( ) . toArray ( size -> ( A [ ] ) Array . newInstance ( elementClass , size ) ) ; }
Returns an array containing all the stream elements using the supplied element type class to allocate an array .
31,367
@ SuppressWarnings ( "unchecked" ) public < A > A [ ] toArray ( A [ ] emptyArray ) { if ( emptyArray . length != 0 ) { throw new IllegalArgumentException ( "Empty array must be supplied" ) ; } return stream ( ) . toArray ( size -> size == 0 ? emptyArray : ( A [ ] ) Array . newInstance ( emptyArray . getClass ( ) . getC...
Returns an array containing all the stream elements . If the stream happens to contain no elements the supplied empty array is returned instead . Otherwise the new array is allocated which element type is the same as the element type of supplied empty array .
31,368
public < U , C extends Collection < U > > C toFlatCollection ( Function < ? super T , ? extends Collection < U > > mapper , Supplier < C > supplier ) { return map ( mapper ) . collect ( supplier , Collection :: addAll , Collection :: addAll ) ; }
Returns a collection created by provided supplier function which contains all the elements of the collections generated by provided mapper from each element of this stream .
31,369
public < C extends Collection < ? super T > > C into ( C collection ) { if ( isParallel ( ) ) { @ SuppressWarnings ( "unchecked" ) List < T > list = Arrays . asList ( ( T [ ] ) toArray ( ) ) ; collection . addAll ( list ) ; } else { Spliterator < T > spltr = spliterator ( ) ; if ( collection instanceof ArrayList ) { lo...
Drains the stream content into the supplied collection .
31,370
public final StreamEx < T > ifEmpty ( T ... values ) { return ifEmpty ( null , Spliterators . spliterator ( values , Spliterator . ORDERED ) ) ; }
Returns a stream which contents is the same as this stream except the case when this stream is empty . In this case its contents is replaced with supplied values .
31,371
public StreamEx < T > without ( T value ) { if ( value == null ) return filter ( Objects :: nonNull ) ; return remove ( value :: equals ) ; }
Returns a stream consisting of the elements of this stream that don t equal to the given value .
31,372
public void forPairs ( BiConsumer < ? super T , ? super T > action ) { pairMap ( ( a , b ) -> { action . accept ( a , b ) ; return null ; } ) . reduce ( null , selectFirst ( ) ) ; }
Performs an action for each adjacent pair of elements of this stream .
31,373
public StreamEx < T > collapse ( BiPredicate < ? super T , ? super T > collapsible ) { return collapse ( collapsible , selectFirst ( ) ) ; }
Returns a stream consisting of elements of this stream where every series of elements matched the predicate is replaced with first element from the series .
31,374
public StreamEx < List < T > > groupRuns ( BiPredicate < ? super T , ? super T > sameGroup ) { return collapseInternal ( sameGroup , Collections :: singletonList , ( acc , t ) -> { if ( ! ( acc instanceof ArrayList ) ) { T old = acc . get ( 0 ) ; acc = new ArrayList < > ( ) ; acc . add ( old ) ; } acc . add ( t ) ; ret...
Returns a stream consisting of lists of elements of this stream where adjacent elements are grouped according to supplied predicate .
31,375
public < U > StreamEx < U > intervalMap ( BiPredicate < ? super T , ? super T > sameInterval , BiFunction < ? super T , ? super T , ? extends U > mapper ) { return collapseInternal ( sameInterval , PairBox :: single , ( box , t ) -> { box . b = t ; return box ; } , ( left , right ) -> { left . b = right . b ; return le...
Returns a stream consisting of results of applying the given function to the intervals created from the source elements .
31,376
public < R > StreamEx < R > withFirst ( BiFunction < ? super T , ? super T , ? extends R > mapper ) { WithFirstSpliterator < T , R > spliterator = new WithFirstSpliterator < > ( spliterator ( ) , mapper ) ; return new StreamEx < > ( spliterator , context ) ; }
Returns a stream consisting of the results of applying the given function to the the first element and every other element of this stream .
31,377
public static StreamEx < String > split ( CharSequence str , Pattern pattern ) { if ( str . length ( ) == 0 ) return of ( "" ) ; return new StreamEx < > ( pattern . splitAsStream ( str ) , StreamContext . SEQUENTIAL ) ; }
Creates a stream from the given input sequence around matches of the given pattern .
31,378
public static StreamEx < String > split ( CharSequence str , String regex ) { if ( str . length ( ) == 0 ) return of ( "" ) ; if ( regex . isEmpty ( ) ) { return IntStreamEx . ofChars ( str ) . mapToObj ( ch -> new String ( new char [ ] { ( char ) ch } ) ) ; } char ch = regex . charAt ( 0 ) ; if ( regex . length ( ) ==...
Creates a stream from the given input sequence around matches of the given pattern represented as String .
31,379
public boolean put ( T t ) { if ( initial ) { if ( size == data . length ) { if ( size < limit * 2 ) { @ SuppressWarnings ( "unchecked" ) T [ ] newData = ( T [ ] ) new Object [ Math . min ( limit , size ) * 2 ] ; System . arraycopy ( data , 0 , newData , 0 , size ) ; data = newData ; } else { Arrays . sort ( data , com...
Accumulate new element
31,380
public < R > StreamEx < R > mapPartial ( Function < ? super T , ? extends Optional < ? extends R > > mapper ) { return new StreamEx < > ( stream ( ) . map ( value -> mapper . apply ( value ) . orElse ( null ) ) . filter ( Objects :: nonNull ) , context ) ; }
Performs a mapping of the stream content to a partial function removing the elements to which the function is not applicable .
31,381
public Optional < T > minByLong ( ToLongFunction < ? super T > keyExtractor ) { return Box . asOptional ( reduce ( null , ( ObjLongBox < T > acc , T t ) -> { long val = keyExtractor . applyAsLong ( t ) ; if ( acc == null ) return new ObjLongBox < > ( t , val ) ; if ( val < acc . b ) { acc . b = val ; acc . a = t ; } re...
Returns the minimum element of this stream according to the long values extracted by provided function . This is a special case of a reduction .
31,382
public Optional < T > minByDouble ( ToDoubleFunction < ? super T > keyExtractor ) { return Box . asOptional ( reduce ( null , ( ObjDoubleBox < T > acc , T t ) -> { double val = keyExtractor . applyAsDouble ( t ) ; if ( acc == null ) return new ObjDoubleBox < > ( t , val ) ; if ( Double . compare ( val , acc . b ) < 0 )...
Returns the minimum element of this stream according to the double values extracted by provided function . This is a special case of a reduction .
31,383
public < V extends Comparable < ? super V > > Optional < T > maxBy ( Function < ? super T , ? extends V > keyExtractor ) { return Box . asOptional ( reduce ( null , ( PairBox < T , V > acc , T t ) -> { V val = keyExtractor . apply ( t ) ; if ( acc == null ) return new PairBox < > ( t , val ) ; if ( val . compareTo ( ac...
Returns the maximum element of this stream according to the natural order of the keys extracted by provided function . This is a special case of a reduction .
31,384
public Optional < T > maxByInt ( ToIntFunction < ? super T > keyExtractor ) { return Box . asOptional ( reduce ( null , ( ObjIntBox < T > acc , T t ) -> { int val = keyExtractor . applyAsInt ( t ) ; if ( acc == null ) return new ObjIntBox < > ( t , val ) ; if ( val > acc . b ) { acc . b = val ; acc . a = t ; } return a...
Returns the maximum element of this stream according to the int values extracted by provided function . This is a special case of a reduction .
31,385
public < U > U foldRight ( U seed , BiFunction < ? super T , U , U > accumulator ) { return toListAndThen ( list -> { U result = seed ; for ( int i = list . size ( ) - 1 ; i >= 0 ; i -- ) result = accumulator . apply ( list . get ( i ) , result ) ; return result ; } ) ; }
Folds the elements of this stream using the provided seed object and accumulation function going right to left .
31,386
public Optional < T > foldRight ( BinaryOperator < T > accumulator ) { return toListAndThen ( list -> { if ( list . isEmpty ( ) ) return Optional . empty ( ) ; int i = list . size ( ) - 1 ; T result = list . get ( i -- ) ; for ( ; i >= 0 ; i -- ) result = accumulator . apply ( list . get ( i ) , result ) ; return Optio...
Folds the elements of this stream using the provided accumulation function going right to left .
31,387
public < U > List < U > scanLeft ( U seed , BiFunction < U , ? super T , U > accumulator ) { List < U > result = new ArrayList < > ( ) ; result . add ( seed ) ; forEachOrdered ( t -> result . add ( accumulator . apply ( result . get ( result . size ( ) - 1 ) , t ) ) ) ; return result ; }
Produces a list containing cumulative results of applying the accumulation function going left to right using given seed value .
31,388
public List < T > scanLeft ( BinaryOperator < T > accumulator ) { List < T > result = new ArrayList < > ( ) ; forEachOrdered ( t -> { if ( result . isEmpty ( ) ) result . add ( t ) ; else result . add ( accumulator . apply ( result . get ( result . size ( ) - 1 ) , t ) ) ; } ) ; return result ; }
Produces a list containing cumulative results of applying the accumulation function going left to right .
31,389
@ SuppressWarnings ( "unchecked" ) public < U > List < U > scanRight ( U seed , BiFunction < ? super T , U , U > accumulator ) { return toListAndThen ( list -> { List < U > result = ( List < U > ) list ; result . add ( seed ) ; for ( int i = result . size ( ) - 2 ; i >= 0 ; i -- ) { result . set ( i , accumulator . app...
Produces a list containing cumulative results of applying the accumulation function going right to left using given seed value .
31,390
public List < T > scanRight ( BinaryOperator < T > accumulator ) { return toListAndThen ( list -> { for ( int i = list . size ( ) - 2 ; i >= 0 ; i -- ) { list . set ( i , accumulator . apply ( list . get ( i ) , list . get ( i + 1 ) ) ) ; } return list ; } ) ; }
Produces a collection containing cumulative results of applying the accumulation function going right to left .
31,391
public S prefix ( BinaryOperator < T > op ) { Spliterator < T > spltr = spliterator ( ) ; return supply ( spltr . hasCharacteristics ( Spliterator . ORDERED ) ? new PrefixOps . OfRef < > ( spltr , op ) : new PrefixOps . OfUnordRef < T > ( spltr , op ) ) ; }
Returns a stream containing cumulative results of applying the accumulation function going left to right .
31,392
@ SuppressWarnings ( "unchecked" ) public < U > U chain ( Function < ? super S , U > mapper ) { return mapper . apply ( ( S ) this ) ; }
Necessary to generate proper JavaDoc
31,393
private R connectEmpty ( ) { synchronized ( root ) { Connector < T , R > l = left , r = right ; if ( l == null ) { return pushRight ( none ( ) , none ( ) ) ; } left = right = null ; l . rhs = null ; T laright = l . right ; l . right = none ( ) ; if ( l . acc == NONE ) { if ( r == null ) l . drain ( ) ; else { if ( l . ...
l + r
31,394
public < R > StreamEx < R > mapKeyValuePartial ( BiFunction < ? super K , ? super V , ? extends Optional < ? extends R > > mapper ) { return mapPartial ( toFunction ( mapper ) ) ; }
Performs a mapping of the stream keys and values to a partial function removing the elements to which the function is not applicable .
31,395
public EntryStream < K , V > filterKeys ( Predicate < ? super K > keyPredicate ) { return filter ( e -> keyPredicate . test ( e . getKey ( ) ) ) ; }
Returns a stream consisting of the elements of this stream which keys match the given predicate .
31,396
public EntryStream < K , V > filterValues ( Predicate < ? super V > valuePredicate ) { return filter ( e -> valuePredicate . test ( e . getValue ( ) ) ) ; }
Returns a stream consisting of the elements of this stream which values match the given predicate .
31,397
public EntryStream < K , V > filterKeyValue ( BiPredicate < ? super K , ? super V > predicate ) { return filter ( e -> predicate . test ( e . getKey ( ) , e . getValue ( ) ) ) ; }
Returns a stream consisting of the elements of this stream which elements match the given predicate .
31,398
public EntryStream < K , V > removeKeys ( Predicate < ? super K > keyPredicate ) { return filterKeys ( keyPredicate . negate ( ) ) ; }
Returns a stream consisting of the elements of this stream which keys don t match the given predicate .
31,399
public EntryStream < K , V > peekKeys ( Consumer < ? super K > keyAction ) { return peek ( e -> keyAction . accept ( e . getKey ( ) ) ) ; }
Returns a stream consisting of the entries of this stream additionally performing the provided action on each entry key as entries are consumed from the resulting stream .