Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

partioning operation Java

@Test
public void givenList_whenParitioningIntoSublistsUsingPartitionBy_thenCorrect() {
    List<Integer> intList = Lists.newArrayList(1, 2, 3, 4, 5, 6, 7, 8);

    Map<Boolean, List<Integer>> groups = 
      intList.stream().collect(Collectors.partitioningBy(s -> s > 6));
    List<List<Integer>> subSets = new ArrayList<List<Integer>>(groups.values());

    List<Integer> lastPartition = subSets.get(1);
    List<Integer> expectedLastPartition = Lists.<Integer> newArrayList(7, 8);
    assertThat(subSets.size(), equalTo(2));
    assertThat(lastPartition, equalTo(expectedLastPartition));
}
Comment

PREVIOUS NEXT
Code Example
Java :: get random word from xz file 
Java :: why does the ribbon dependency crush my app 
Java :: how to calculate min, max and average and write the output into into a text file in java 
Java :: android studio fecth audio from app directory 
Sql :: sql developer search all packages for text 
Sql :: conda install sqlalchemy 
Sql :: mysql create user 
Sql :: oracle change nls_date_format permanently 
Sql :: sql find text in sp 
Sql :: loading local data is disabled mysql 
Sql :: oracle create directory 
Sql :: start postgresql 
Sql :: uninstall mysql on ubuntu 
Sql :: SELECT list is not in GROUP BY clause 
Sql :: mysql show databases 
Sql :: Cannot load driver class: com.mysql.cj.jdbc.Driver 
Sql :: how to list columns for particular tables in postgresql 
Sql :: mysql date minus 1 day 
Sql :: mysql first day of year 
Sql :: how to stop all connections to a psql 12 database? 
Sql :: oracle all_source package body 
Sql :: get year from date postgres 
Sql :: mysql last day of next month 
Sql :: sqlite list columns 
Sql :: best configuration for display table in sqlplus 
Sql :: postgres read table structure 
Sql :: oracle sleep 1 second 
Sql :: query to check cpu utilization in oracle database 
Sql :: mysql get random row 
Sql :: oracle user tables 
ADD CONTENT
Topic
Content
Source link
Name
6+1 =