"Finally, you're done. I'm tired of trying to keep your tasks in my head. Here's a couple more to keep you in shape:"
Practice with lists
Comments (75)
- Popular
- New
- Old
You must be signed in to leave a comment
Mindaugas
5 September 2023, 13:04
in first task - Words in reverse, if you create second ArrayList for solution, it will not pass testing, although everything is working, so think of more simple solution :)
0
Rebecca Zee
18 July 2023, 16:18
The More Sam-I-Am task shouldn't even be considered medium. I would consider it an easy task. I didn't even have to use any looping to add any elements into the ArrayList. If you paid attention to the lesson right before this, it shouldn't even be hard to do.
0
Anonymous #10782038
18 March, 19:24
its not medium, its listed as an easy..
0
Xavi MartinExpert
25 October 2022, 07:21
Can someone explain to me what this symbol means? ->
+1
Dzmitry Antsipin
22 December 2022, 21:15
It's about lambda expressions - we'll meet with it afterwards
+1
Michael Amann Full Stack Developer
21 April 2022, 16:16
I think showing the students how to read from a file earlier would help immensely in testing. Instead of typing over and over you could just read from a file to test input and NOT have to take that code out and implement another input method to submit.
+2
ayadi1 Full Stack Developer
30 April 2022, 22:44
i think so 😬
0
AHMET YORULMAZ
27 October 2021, 07:52
"If half or more of your actions seem to be meaningless, don't worry: you probably clearly understand the fragility of existence"👍
0
Justin Smith
11 July 2021, 00:50
A hint that makes quite a few of these much easier... a for loop is not required to start counting from small to large. You can go the other way (i.e. for(int i = 9; i >= 0; i--) instead of for(int i = 0; i < 10; i++). This is really useful when removing elements from an arraylist or adding them into a specific location, where you don't want to affect the index values of the elements you have yet to iterate through.
+6
Romant QA
22 April 2022, 22:55
Thankyou! Idea of backward looping helps to avoid exception on members numbering when adding new members.
0
DarthGizka
29 May 2021, 12:57
task0715 (More Sam-I-Am) caveat: you will get failed if you initialise the ArrayList and fill it in one go. They want you to add the initial three strings in a separate statement to an initially empty list (but Collections.addAll() gets accepted for that, for example).
+1
Gokhan35
5 January 2022, 15:06
ArrayList<String> list = new ArrayList<String>(Arrays.asList("Sam", "I", "Am"));
I did it like this but you have to import the Arrays class using;
import java.util.Arrays;
+1
Libby
17 January 2021, 17:49
Is there any way to see output and input on IntelliJ?
+5
OlhaExpert
18 January 2021, 10:39
Please contact the support team at support@codegym.cc for further assistance.
0
Ajani
9 January 2021, 22:07
So i notice this a lot recently when i compare how I solve a problem to how site's coders solved it. When forming an array or list, and taking entries from a keyboard the site's programmers almost always write the entry to a variable before then taking that variable and adding it to a list. Why take the extra step? why not just code the typed entry directly into your list/array?
+1
DarthGizka
29 May 2021, 12:16
Catching a value in an explicit variable has several advantages:
* you can give the value a name that tells you what it means (can be important with complicated math)
* it allows you to watch the value in a debugger
* it helps with breaking complex tasks/expressions into simpler, more elementary ones that are easier to process for humans; this means fewer coding errors when writing code and less overload when reading it
+7
Donny
3 January 2021, 18:55
My code passed the tests on Javarella, but I don't understand why this code worked:
int a = Integer.parseInt(bis.readLine())
In using the Integer.parseInt method, don't we convert a string into an int, that is a primitive value? How can that int then be added to an ArrayList when ArrayLists cannot take primitive values. Don't we have somehow use the Integer wrapper class to turn the int into an object? Thanks for any thoughts on this. Happy New Year 2021 to all! Donny
+5
Mina Nabil
4 January 2021, 10:26
What actually happens when we add a primitive type value to an ArrayList is that an object of the associated wrapper class - with the primitive value “wrapped inside” - is automatically created and added to the list.This is known as autoboxing.
+6