How to generate unique random number and extract 8 of the number out to store and display it using lambdas and stream?

I'm exploring lambdas and streams currently and do not understand how to apply it on my codes

I am stuck as I want to use lambdas and streams to generate 64 unique random number, 8 of which numbers (7 numbers in blue and last number in red color ) in the 64 to store and display in another row below.

My desired output:

class Lucky8 extends JFrame {

private final JButton[] jbArray;

public Lucky8() {

super("Lucky 8");

setLayout (new GridLayout(8, 8));

jbArray = new JButton [64];

for (int i = 0; i < 64; i++) {

//jbArray[i] = new JButton...

Read More »

By: StackOverFlow - Thursday, 8 November

Related Posts