• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 165
  • Last Modified:

Data types constructed from the four fundamental data types

Hi,

I've been searching everywhere, and simply can't find examples of abstract data types constructed from the four fundamental data types. I'm trying to find examples that implement the following combinations,

- a list with components that are a tree
- a graph with components that are lists
- a list with components that are a set
- a tree with components that are lists
- a list with components that are graphs

eg: a set of lists could be used to model a map and so on. I'm trying to think of these from a purely theoretical standpoint, prior to implementation. Has anybody got any ideas of theoretical ADTs for the above combinations?

Any help appreciated.

Thanks

0
nhay59
Asked:
nhay59
2 Solutions
 
colr__Commented:
Not sure if I understand you correctly, but since the collection API is littered with classes that imlement the Colelction interface, then each of thes classes can be used to hold instances of each other.

For example, for your first point "- a list with components that are a tree", you could use an ArrayList that holds TreeMap's.

Apologies if Ive understood you wrong.

colr__
0
 
Mayank SAssociate Director - Product EngineeringCommented:
You can perhaps create such collections using generics in Java 5.0, like:

ArrayList <TreeMap> list = new ArrayList <TreeMap> () ;
// is: >> "- a list with components that are a tree", you could use an ArrayList that holds TreeMap's.

Same way you can define the others.
0
 
nhay59Author Commented:
Hi,

Thanks for the replies.

Have a good weekend.
0

Featured Post

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.

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