Iterate on an object

Posted on 2006-04-02
Last Modified: 2011-09-20
For example, I have a Photograph class; the constructor summary is:

Photograph(java.lang.String location, int width, int height, java.util.Date date, java.lang.String description, Person[] subjects, Event event)

Is is possible for me to loop on an object's attibutes?

For example, can I do something like

Loop on a Photograph, for each attibute, I assign it to a collection. Hence, for a Photograph object, I have 7 collection, each with differet type (string, int, event, date, etc)

Just curious.

Question by:tiger0516
    1 Comment
    LVL 92

    Accepted Solution

    Not without implementing it yourself.
    ie. there is no builtin support for doing it

    Featured Post

    Enabling OSINT in Activity Based Intelligence

    Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

    Join & Write a Comment

    Suggested Solutions

    Title # Comments Views Activity
    Using java code in .Net/c#: namespace issue 3 38
    sumHeights  challenge 17 50
    Fibonacci challenge 11 61
    HashMap Vs TreeMap 12 33
    By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
    Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
    Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
    Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…

    734 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    23 Experts available now in Live!

    Get 1:1 Help Now