Manoj Sahu,CITE,Bangalore

Manoj Sahu,CITE,Bangalore

Hi dear 
I have a problem, please solve it,please give me solution within 1-2 days.I am a Student,MCA. ie I want to pass a list to a method and within method definition i removed the duplicate elements and when i returned the list to the calling method.when i compiled the code ,an  errors occurs that is:
 removeDuplicateFromArraListByMethod.java:21:<identifier> expected public String showNonDuplicateElements(list1)
---------------Below is my code, I tried---------------------

import java.util.*;
public class removeDuplicateFromArraListByMethod 
{
public static void main(String args[]) throws Exception
{
        nonDuplicateFound  ob=new nonDuplicateFound();
        ArrayList<String>list=new ArrayList<String>();
        list.add("A");
        list.add("A");
        list.add("A");
        list.add("B");
        list.add("B");
        list.add("C");

      ArrayList list3= ob.showNonDuplicateElements(list); 
        for(Object item:List3)
        System.out.println(item);
 }
 }   class nonDuplicateFound
      {
          public String showNonDuplicateElements(list1)
          {
        HashSet set=new HashSet(list1);

        ArrayList newList=new ArrayList(set);

        Collections.sort(newList);
        return newList;
        }
}   
 kindly solve my problem and send to <[email protected]>
                             Thanks & Regards
                                Manoj
View Answers









Related Tutorials/Questions & Answers:
Manoj Sahu,CITE,Bangalore
Manoj Sahu,CITE,Bangalore   Hi dear I have a problem, please solve it,please give me solution within 1-2 days.I am a Student,MCA. ie I want to pass... Manoj
Manoj Sahu,CITE,Bangalore
Manoj Sahu,CITE,Bangalore   Hi dear I have a problem, please solve it,please give me solution within 1-2 days.I am a Student,MCA. ie I want to pass... Manoj
Advertisements
ModuleNotFoundError: No module named 'manoj'
ModuleNotFoundError: No module named 'manoj'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'manoj' How to remove the ModuleNotFoundError: No module named 'manoj'
J2ME project - Java Beginners
. IT'S VERY URGENT PLEASE........................ thanks manoj kumar
J2ME project - Java Beginners
. IT'S VERY URGENT PLEASE........................ thanks manoj kumar
Facing Problem to insert Multiple Array values in database - JSP-Servlet
Manoj   Hi friend, You Have Problem in Data Table and check
Tomcat jar file issue - JSP-Servlet
Manoj
Packing a JTable Component
;},   {"Manoj","Biology","4"},   {"Sanjay"
Remove Unique Column in Database Table
manoj che 50 103 Aman phy 85
Enabling Row, Column and Cell Selections in a JTable
;,"2"},   {"Manoj","Biology","4"},  
Setting the Margin Between Cells in a JTable
;  {"Manoj","Biology","4"},    {"
Disabling User Edits in a JTable Component
;  {"Manoj","Biology","4"},    {"
Create a Custom Cell Renderer in a JTable
; {"Manoj","Biology","4"},    {"Sanjay"
Setting an Icon with Text in a Column Head of JTable
;},    {"Manoj","Biology","4"},   
Setting Grid Line in JTable
;,"2"},    {"Manoj","Biology","4"
WEBSERVICE USING APACHE AXIS -TUTORIAL-2 UNDERSTANDING APACHE AXIS
been made by Manoj Kothale who has written about such templates, which can... such technology, which was covered by Manoj Kothale in DeveloperIQ, March ?04
Testing Struts Application
name="queryForm" scope=&q scope="session" input="...; by Manoj Kothale ( DeveloperIQ.....August-2003
ALL command - SQL
ALL Command in Java & SQL  Nee all commands in Java.  Dear Manoj, I didn't get u what do u mean by all command. could u please be a bit clear for understanding ur question. Thank u   VARIOUS COMMANDS
Hibernate Many-to-many Relationships
;Author();   manojAuth.setAuthorName("Manoj");   

Ads