Skip to content
Advertisement

Tag: arrays

Select Random element from ArrayList print then remove It

Hi so I have this array list of questions and I want to choose it randomly then delete it one by one until there’s no more so that It wont load the same question twice but there is some problem for example I have 3 questions in the question arraylist sometime it only loads 1 or two even the same

How to merge multiple Arrays containing the same value in Java

I’m struggling to find the best way to merge arrays (or create new ones) by looking at their shared value. this is my “dictionary” filled with arrays of 2 words, for example it contains arrays: I need to merge them by values they share, so for example the finished “dictionary” (or completely new list) would look like this: Also, the

Converting a scanner.next() to a char[]

I want to give a function a char array from scanner.next(). I only get an error message if I try to convert it like I do it now: This is the errormessage I get: It also shows this error on the other ones where I want to pass the char[] over. Need to add more text cause they say it

How would I move a blank space in a 2d array?

I’m working on a Slider puzzle game and I’m not sure how I would go about moving a “blank” around the array. The puzzle would something like this but randomized. Each method has a prerequisite indicating if it can move a certain direction or not. Answer Here is an example of how you could implement right(), the rest of the

In an array of arraylists, get the largest arraylist

I have an array with multiple arraylists of different sizes. I want to find the index of the largest arraylist in the array. I tried this: disc being the name of the array of arraylists. ArrayList I believe doesn’t implement the Comparable interface so I can’t do it like this. Is there a way to make a custom comparable for

Advertisement