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

  • SEARCH
  • Home
  • 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 7667777
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T15:11:26+00:00 2026-05-31T15:11:26+00:00

EDIT: This is just a tiny snippet of the code if you have any

  • 0

EDIT: This is just a tiny snippet of the code if you have any questions I can post more.

Trying to write a process scheduling algorithm in Java using Queues and I am running into this warning. Can anyone help me fix this warning?

prog2.java:115: warning: [unchecked] unchecked call to add(E) as a member of the raw type java.util.Collection
                    notSubmitted.add(p[r]);

Here is the code that I am having trouble with. I think I need to use Generics but I haven’t used them before.

static Queue notSubmitted = new LinkedList();
...
for(int j = 0; j < numProcesses; ++j)
            {
                    pid = i.nextInt();
                    priority = i.nextInt();
                    submissionTime = i.nextInt();
                    totalCpuTime = i.nextInt();
                    computeTime = i.nextInt();
                    ioTime = i.nextInt();
                    p[j] = new Process(pid, priority, submissionTime, totalCpuTime, computeTime, ioTime);
            }
for(int r = 0; r < numProcesses; ++r)
            {
                    //populate the not submitted queue first
                    notSubmitted.add(p[r]);
            }
  • 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-05-31T15:11:28+00:00Added an answer on May 31, 2026 at 3:11 pm

    To get rid of the warning, you can use generics in your queue declaration as follows (Java 5 & 6):

    static Queue<Process> notSubmitted = new LinkedList<Process>();
    

    or if you use Java 7+:

    static Queue<Process> notSubmitted = new LinkedList<>();
    

    That tells the compiler that you only plan to add Process objects to that list.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I just can't remember the terminology used for this and other related properties. EDIT
I can edit this UserControl just fine in visual studio but I get this
EDIT: Just to make things clear, this problem was caused by a typo in
** EDIT ** Nevermind, just needed to take out the parens... I get this
edit alright, I guess C is painful in nature--Just, this part, is particularly painful.
EDIT: This was formerly more explicitly titled: - Best solution to stop Kontiki's KHOST.EXE
EDIT: This question is more about language engineering than C++ itself. I used C++
Edit: This was accidentally posted twice. Original: VB.NET Importing Classes I've seen some code
Edit: This code is fine. I found a logic bug somewhere that doesn't exist
This is hard to explain, so let me just give you a link: http://jsbin.com/izinoy/6/edit#html,live

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.