Home Answers Viewqa Java-Interview-Questions Manoj Sahu,CITE,Bangalore

 
 


Manoj kumar
Manoj Sahu,CITE,Bangalore
0 Answer(s)      2 years and 7 months ago
Posted in : Java Interview Questions

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 <m.kumara.mca@gmail.com>
                             Thanks & Regards
                                Manoj
View Answers









Related Pages:
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
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
Packing a JTable Component
; {"Rahul","History","2"},   {"Manoj","
Disabling User Edits in a JTable Component
;Rahul","History","2"},    {"Manoj","
Enabling Row, Column and Cell Selections in a JTable
; {"Rahul","History","2"},   {"Manoj","
Setting Grid Line in JTable
; {"Rahul","History","2"},    {"Manoj"
Setting the Margin Between Cells in a JTable
;History","2"},    {"Manoj","Biology","
Remove Unique Column in Database Table
phy NULL 104 manoj che 50 103
Create a Custom Cell Renderer in a JTable
","2"},    {"Manoj","Biology","4"
Setting an Icon with Text in a Column Head of JTable
;,"History","2"},    {"Manoj","Biology"
WEBSERVICE USING APACHE AXIS -TUTORIAL-2 UNDERSTANDING APACHE AXIS
by Manoj Kothale who has written about such templates, which can be found..., which was covered by Manoj Kothale in DeveloperIQ, March ?04 issue &
Testing Struts Application
---November-2002) 'Understanding Struts Framework' by Manoj Kothale
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");   

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.