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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T04:08:43+00:00 2026-06-06T04:08:43+00:00

I’ve a list which is List < TempVO> lstTemp = new ArrayList < TempVO>

  • 0

I’ve a list which is

List < TempVO> lstTemp = new ArrayList < TempVO> ();

TempVO is a class containing

zoneId,tempId and tempValue

now the list will have entries like mentioned below

zoneId tempId tempValue
-----------------------
 2 /     1    /  check    
 2   /    3     /check  
 2    /   4   /  check  
 2     /  4   /  entered1  
 3    /   5   /  check  
 3     /  8    / primary  
 3    /   6  /   check  
 3   /    8   /  check  

My requirement is to remove that entries with tempValue= check from the list where if it has 2 entries for the same zoneId and tempId
(i,e) my new list should contain

zoneId tempId tempValue
-----------------------
 2 /     1    /  check    
 2   /    3     /check    
 2     /  4   /  entered1  
 3    /   5   /  check  
 3     /  8    / primary  
 3    /   6  /   check  

How do i do this?

  • 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-06T04:08:44+00:00Added an answer on June 6, 2026 at 4:08 am

    I wrote something up for you. I implemented the class TempVO and iterated over a list of those in a main function(my programs entry point) using a nested loop. I check for every TempVO if the tempValue is “check”. If so, I check if there is another TempVO in the list with the same zoneId and tempId. If so, I don’t print the TempVO. You can follow it in my code:

    import java.util.ArrayList;
    import java.util.List;
    class TempVO {
        private int zoneId;
        private int tempId;
        private String tempValue;
        public TempVO(int zoneId, int tempId, String tempValue) {
            super();
            this.zoneId = zoneId;
            this.tempId = tempId;
            this.tempValue = tempValue;
        }
        public int getZoneId() {
            return zoneId;
        }
        public void setZoneId(int zoneId) {
            this.zoneId = zoneId;
        }
        public int getTempId() {
            return tempId;
        }
        public void setTempId(int tempId) {
            this.tempId = tempId;
        }
        public String getTempValue() {
            return tempValue;
        }
        public void setTempValue(String tempValue) {
            this.tempValue = tempValue;
        }
        @Override
        public String toString() {
        return "zonedId: " + this.zoneId + " | tempId: " + this.tempId + " | tempValue: " + this.tempValue;
        }
    }
    public class Main { 
        public static void main(String[] args) {
            // initialize list
            List<TempVO> tempVOs = new ArrayList<>();
            tempVOs.add(new TempVO(2, 1, "check"));
            tempVOs.add(new TempVO(2, 3, "check"));
            tempVOs.add(new TempVO(2, 4, "check"));
            tempVOs.add(new TempVO(2, 4, "enterd1"));
            tempVOs.add(new TempVO(3, 5, "check"));
            tempVOs.add(new TempVO(3, 8, "primary"));
            tempVOs.add(new TempVO(3, 6, "check"));
            tempVOs.add(new TempVO(3, 8, "check"));
            // only print values wherein interested
            for(int i = 0; i < tempVOs.size(); i++) {
                TempVO outerTempVO = tempVOs.get(i);
                boolean keep = true;
                if("check".equals(outerTempVO.getTempValue())) {
                    for(int j = 0; j < tempVOs.size(); j++) {
                        if(i != j) {
                            TempVO innerTempVO = tempVOs.get(j);
                            if(outerTempVO.getTempId() == innerTempVO.getTempId() && outerTempVO.getZoneId() == innerTempVO.getZoneId()) {
                                keep = false;
                                break;
                            }
                        }
                    }
                }
                if(keep)
                    System.out.println(outerTempVO);
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a jquery bug and I've been looking for hours now, I can't
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
I have a text area in my form which accepts all possible characters from
I used javascript for loading a picture on my website depending on which small
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I am trying to understand how to use SyndicationItem to display feed which is
I would like to run a str_replace or preg_replace which looks for certain words
I want use html5's new tag to play a wav file (currently only supported

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.