1. Write a Java program to create a new array list, add some colors (string) and print out the collection. The list should contain color "green". 2. Change the previous program to insert an element into the array list at the first position. 3. Change the application to print out the index of color "green". 4. Change the previous application to replace "green" value with "yellow". 5. Change the previous application to remove the third element from the list. 6. Change the application to sort the list of colors. 7. Change the application to shuffle the list of colors. 8. Change the application such that it swaps colors "Orange" and "Red". 9. Change the application to copy the current list into a new list. 10. Change the application to trim the capacity of the initial array list to the current list size. 11. Change the application to empty the second list. 12. Change the application to test (print out a message) if the second list is empty. 13. Change the application to increase the capacity of the first list to 25 colors.

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter8: Arrays
Section: Chapter Questions
Problem 9PE
icon
Related questions
Question

1. Write a Java program to create a new array list, add some colors (string) and print out the collection. The list should contain color "green".

2. Change the previous program to insert an element into the array list at the first position.

3. Change the application to print out the index of color "green".

4. Change the previous application to replace "green" value with "yellow".

5. Change the previous application to remove the third element from the list.

6. Change the application to sort the list of colors.

7. Change the application to shuffle the list of colors.

8. Change the application such that it swaps colors "Orange" and "Red".

9. Change the application to copy the current list into a new list.

10. Change the application to trim the capacity of the initial array list to the current list size.

11. Change the application to empty the second list.

12. Change the application to test (print out a message) if the second list is empty.

13. Change the application to increase the capacity of the first list to 25 colors.

 

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT