Pass a list to Vector and sort it

@Test

public void testVector()

{

LinkedList<Integer>list =new LinkedList<Integer>();

list.add(30);

list.add(20);

list.add(10);

list.add(40);

Collections.addAll(list);

Collections.sort(list);

Vector<Integer> vector=new Vector<Integer>(list);

for(Integer i:vector)

System.out.println(i);

}

Advertisements

About qainterviews

Software Geek,QA Expert,Blogger
This entry was posted in Java, Uncategorized and tagged , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s