Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8453343
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T11:44:51+00:00 2026-06-10T11:44:51+00:00

Why does java.util.Stack allows me to create a new Stack in an android activity

  • 0

Why does java.util.Stack allows me to create a new Stack in an android activity with a simple constructor like:

Stack < ImageView> stack = new Stack< ImageView>();

and i cannot do the same with java.util.Queue? Shouldn’t a queue have a similar constructor? Strange enough on http://developer.android.com/reference/java/util/Stack.html it says the Stack has a public constructor and on http://developer.android.com/reference/java/util/Queue.html i don’t see a similar constructor for a queue.. why is that? what is the way to have a Queue of ImageView elements for example?
Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T11:44:53+00:00Added an answer on June 10, 2026 at 11:44 am

    Because Queue is an interface, you should initial it with a LinkedList:

    Queue<String> qe = new LinkedList<String>();
    
    qe.add("b");
    qe.add("a");
    qe.add("c");
    
    //Traverse queue
    Iterator it = qe.iterator();
    
    System.out.println("Initial Size of Queue :" + qe.size());
    
    while(it.hasNext())
    {
       String iteratorValue = (String) it.next();
       System.out.println("Queue Next Value :" + iteratorValue);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

does anyone know if the following java Method in the java.util.concurrent Package ScheduledExecutorService.html#scheduleAtFixedRate() absolutely
This is probably a quicky. Why does this code not return anything? import java.util.Scanner;
Is there any Java function or util class which does rounding this way: func(3/2)
Does Java have (or is there a library available) that allows me to have
How does scala.collection.JavaConversions supercede the answers given in Stack Overflow question Iterating over Java
By default, what time zone does method java.util.Date.toString() display? Since a Java Date stores
Why does the java.util.Set interface lack get(int Index) , or any similar get() method?
import java.util.Iterator; import java.util.Stack; public class StackExample { public static void main(String args[]){ Stack<String>
Does java.util.List.isEmpty() check if the list itself is null , or do I have
Why does java.util.Map.values() allow you to delete entries from the returned Collection when it

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.