Solved

Java passing arguments (type error)

Posted on 2016-10-30
2
33 Views
Last Modified: 2016-11-10
I have a piece of code that accepts the following:  (List<?extends Object> list)
When I call the code, I need to pass it a List, of course. However, in my code that calls it, I need to piece together the name of that list using String functions (with a String result).  But, the function I am calling needs a List, not a String.

How do pass the argument as a List when actually what I have is a String of the name of the List?
0
Comment
Question by:MarkLoveExEx
2 Comments
 
LVL 32

Expert Comment

by:Stefan Hoffmann
Comment Utility
Can your rephrase your question? Why do you have to "piece together the name of the list"? Post a concise and complete example of what you have so far.
0
 
LVL 16

Accepted Solution

by:
krakatoa earned 500 total points
Comment Utility
You have to find the list based on its name once you've assembled that name, and then pass the found list to your method. You could keep your lists in a Map if you like.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

743 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

13 Experts available now in Live!

Get 1:1 Help Now