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 8918053
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T05:39:14+00:00 2026-06-15T05:39:14+00:00

I finished the assignment that I was working on. But i’m trying to modify

  • 0

I finished the assignment that I was working on.
But i’m trying to modify it a little

What I’m trying to do is remove a record and I want ot use an iterator to do it.
if I was using a for each loop it would be something like this.

for(People someone : person)
    (someone instanceof Parent)
        ((Parent)someone.whatever

How would you do that with an iterator?

thanks in advance

  • 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-15T05:39:15+00:00Added an answer on June 15, 2026 at 5:39 am

    I think this is what you are looking for:

    public static void main(String[] args) {
        List<Parent> myList = new ArrayList<Parent>();
        Iterator<Parent> iterator = myList.iterator();
        while (iterator.hasNext()) {
            Parent p = iterator.next();
            if (p instanceof Child) {
              //do something with the Child
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So I finished my first C++ programming assignment and received my grade. But according
Already finished implementing the player. I want to implement the progress bar. But I
I finished first year comp sci. And i want to spend some time working
I am working on a short java assignment that I have been set. The
I am nearly finished with my first assignment but the last question has me
I'm making a small assignment using semaphores. I want to destroy the semaphore once
I'm working on a homework assignment for CS1, and I almost have it finished
I just finished my first assignment using arrays and I feel like it is
I'm working on a homework assignment that requires me to compute the grayscale value
I finished the English version of my application and now I am working on

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.