Last active
April 9, 2020 06:55
-
-
Save shankar524/cd16574d4adb7998efd8bc5552ab0272 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.cf.pm; | |
import java.util.Arrays; | |
import java.util.List; | |
import java.util.stream.*; | |
import java.util.Random; | |
public class HelloWorld{ | |
public static void main(String[] args) { | |
String[] names = {"Aashish", "Abhijeet", "Aneeta", "Asesh", "Barun","Gaurav", "Krishna", "Prakash", "Puru", "Raman", "Rikesh","Rajiv", "Shankar", "Sabita", "Sameer", "Subesh", "Sundar","Swojeet", "Nirdosh", "Madhuri"}; | |
List<String> shuffled_names = shuffledList(Arrays.asList(names)); | |
System.out.println(shuffled_names); | |
} | |
public static List<String> shuffledList(List<String> attendessList) | |
{ | |
int listSize = attendessList.size() | |
List<String> shuffledNames = new Random(). | |
ints(listSize, 0, listSize). | |
mapToObj(i -> attendessList.get(i)). | |
collect(Collectors.toList()); | |
return shuffledNames; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment