Question: Write a Java method that takes a List of String and returns a new List of String containing every other element in the original List.

Write a Java method that takes a List of String and returns a new List of String containing every other element in the original List. The returned List should be half the size of the original List. If the original List has an odd number of elements, the returned List should have half the amount of elements rounded down (i.e. original List has 5, returned List has 2). Make sure there is an if statement

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!