0

I have built an arraydeque and want to pass those Double values as an array to a constructor. The constructor is built to process the array values individually to a certain condition.

When using arraydeque its not allowing me to retrieve those double values (Iterater .next for loop) and store them in an array.

Are there any suggestions to correct this?

1
  • Yeah was going for an arraylist but this is fine. Not for anything major. Sould be able to use the deque directly. Thanks. Commented May 10, 2013 at 3:38

1 Answer 1

2

Try this:

Deque<Double> deque;
Double[] array = Double[deque.size()];
int count = 0;
for (Iterator<Double> i = deque.iterator(); i.hasNext();) {
    array[count++] = i.next();
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.