a. The method accepts an object of type List
b. The return type of the method is void
c. Duplicates are determined using the equals() method (rather than by the == operator)
Your implementation of removeDuplicates should handle, in an appropriate way, the case in which a null List is passed in to the method.
Test your method by writing code in a main method, which does the following:
a. It creates an instance of List and loads it with the following Stringvalues:{“good”, “better”, “best”, “best”, “first”, “last”, “last”, “last”,”good”}
b. It invokes the removeDuplicatesMethod, passing in this instance of List
c. It outputs the modified list to the console
Write a Java method removeDuplicates that removes all duplicates in a given list

阅读 138
收藏 0
点赞 0
评论 0
评论列表
文章目录