[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 647
  • Last Modified:

new features in jdk5.0

hi guys

I am currently using jdk 1.4.2 and would like to upgrade to jdk 5.0

I would like to know what are the new features available and the coding conventions introduced in
jdk5.0 which are  different from or not there in jdk1.4.2

How has the programming coding style changed in jdk5.0?

for example if i have a peice of code using arraylist like this
ArrayList myList = null;
myList = databseAdapter.findBySearch(user, criteria); //querying the database and getting results
for (int i=0; i<myList.size(); i++) {
ValueObject price = (ValueObject) myList.get(i);
if(price.getId != null)
formBean.setId(price.getId);
}

How does using jdk5.0 change the above coding convention in any way or is it the same?

if you guys can give any other examples of what is new in jdk 5.0 , that would be great

thanks
J
0
jaggernat
Asked:
jaggernat
3 Solutions
 
VenabiliCommented:
What about checking the official document for this? :)
http://java.sun.com/j2se/1.5.0/docs/relnotes/features.html 
0
 
sciuriwareCommented:
ArrayList<ValueObject> myList = databseAdapter.findBySearch(user, criteria); //querying the database and getting results
for (ValueObject price :  myList)
{
     if(price.getId != null)
     {
           formBean.setId(price.getId);
     }
}

;JOOP!
0
 
jaggernatAuthor Commented:
well, thanks, but  can you tell me how can we rewrite this peice of below code in jdk5.0

ArrayList myList = null;
myList = databseAdapter.findBySearch(user, criteria); //querying the database and getting results
for (int i=0; i<myList.size(); i++) {
ValueObject price = (ValueObject) myList.get(i);
if(price.getId != null)
formBean.setId(price.getId);
}


how do i rewrite the code/ or make it more simple or efficient  using jdk5.0?

thanks
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
sciuriwareCommented:
Look above your post!
0
 
jaggernatAuthor Commented:
thnks guys,  has usage of arrays also changed in jdk5.0. for example can you tell me how this peice of code using arrays has changed?

ArrayVO desc[] = new ArrayVO[ids.length];
            for (int i = 0; i < desc.length; i++) {
                  desc[i] = Cache.getInstance().getbyId(mktIds[i]);
}

thanks
0
 
CEHJCommented:
No - the use of arrays is the same
0
 
jaggernatAuthor Commented:
ok thanks, can some one tell me the list of things that have changed in jdk5.0 or the new things which have been introduced in jdk5.0? I know Usage of arraylist is one, and what else do we have?

thanks v much
J
0
 
sciuriwareCommented:
But, when retrieving from an array:

for(ArrayVO a: desc)
{
.................. // 'a' accesses every member of the array like above with the ArrayList.
}

;JOOP!
0
 
sciuriwareCommented:
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now