Total members 11829 |It is currently Tue Jun 02, 2020 10:17 pm Login / Join Codemiles

Java

C/C++

PHP

C#

HTML

CSS

ASP

Javascript

JQuery

AJAX

XSD

Python

Matlab

R Scripts

Weka





Code:
import java.util.*;

public class 
Test {
    
Vector list;
    
String[] codes = {"alpha""lambda""gamma""delta""zeta"};

    public 
Test(String[] userCodes){
        list = new 
Vector();
        
//load built-in codes
        
for(int i 0icodes.lengthi++){
            
addCode(codes[i]);
        }

        
//load user codes
        
for(int j 0userCodes.lengthj++){
            
addCode(userCodes[j]);
        }

        
//display all codes
        
for(Iterator ite = list.iterator(); ite.hasNext();){
            
String output = (String)ite.next();
            
System.out.println(output);
        }
    }

    private 
void addCode(String code){
        if(!list.
contains(code)){
            list.
add(code);
        }
    }

    public static 
void main(String args[]){
        
Test keeper = new Test(args);
    }




_________________
Coding my life with Java, PHP, JavaScript, and Python


Author:
Newbie
User avatar Posts: 39
Have thanks: 15 time

For this message the author isuru has received gratitude : DrRakha
Post new topic Reply to topic  [ 1 post ] 

  Related Posts  to : Data Structures: Vector
 how we can search in filehandling without using structures a     -  
 C++ Vector capacity     -  
 Vector class     -  
 Iterator on Vector     -  
 vector front     -  
 count elements in a vector     -  
 Write Vector list to File     -  
 Support Vector Machine coding on Matlab...     -  
 Data set for ID3 algorithm     -  
 What is Data integration?     -  



Topic Tags

Java Collections






Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
All copyrights reserved to codemiles.com 2007-2011
mileX v1.0 designed by codemiles team
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com