Win a copy of Java 9 Revealed this week in the Features new in Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Getting field name position form field info  RSS feed

 
Kalichar Rangantittu
Ranch Hand
Posts: 240
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there any easy way of getting the postion of a field from an array of FieldInfo[] just by the name without having to iterate over the entire array and check for the name? I dont want to create a new datastructure like a list if there is a way out?
 
Kalichar Rangantittu
Ranch Hand
Posts: 240
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What I mean to say, if I want to find the position of the Destination airport from the fieldInfo, how do I do it without iterating through?
 
Bal Sharma
Ranch Hand
Posts: 273
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello:
Is there any easy way of getting the postion of a field from an array of FieldInfo[] just by the name without having to iterate over the entire array and check for the name?
I am not sure how you do it? If you got ARRAY you got to walk through all the indexes to figure out where it is what you want. Oh yes! it is possible if you know the exact index what you are looking for like, FieldInfo[FieldInfo.length -1].
Hope it helps. -Bal
 
Andre Mermegas
Ranch Hand
Posts: 158
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here's an idea I thought of right before i finished my project. I wrote a class that encapsulated a record.
It took a DataInfo object, and had get/set methods for all the fields along with a getNewRecord() method which returned an updated DataInfo object.
[ January 27, 2002: Message edited by: Andre Mermegas ]
 
Kalichar Rangantittu
Ranch Hand
Posts: 240
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Andre, that is the usual way to do, what you are suggesting is a flight buisness object. It the way I would go but I am not sure if the project really needs it. I was hoping that there is some way from the Collections frame work to search for a particular value nested within an array.
Thanks
 
Andre Mermegas
Ranch Hand
Posts: 158
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oh I see.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!