private void filterList()
{
List<String> originalList = new ArrayList<String>();
originalList.add( “abc” );
originalList.add( “ABC” );
originalList.add( “a7c” );
originalList.add( “xyZ” );
List<String> filteredList = new ArrayList<String>();
String[] originalArray = { “abc”, “x” };
for ( String str : originalArray )
{
if ( originalList.contains( str ) )
{
filteredList.add( str );
}
}
System.out.printf( “Original list: %s, Filtered list: %s %n”, originalList, filteredList );
}