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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T22:43:42+00:00 2026-05-19T22:43:42+00:00

i have this script, and it is suppose identifier if a player can assist

  • 0

i have this script, and it is suppose identifier if a player can assist to the suit of a specific card. So, if he assist, show the message, you assist, no problem, but if he does bluff the verification never is done and show the else System.out.println(hand);

the result of this else is [SEVEN of DIAMONDS, FOUR of SPADES, SEVEN of SPADES, KING of DIAMONDS, more cards]

pn50.getText() (the result of this is CLUBS for example)

my doubt is, what reason the line hand.subList(0, 10).contains(pn50.getText()) never finds nothing in the list (that is the hand of the player)

for example, if the player one plays the king of hearts, and the player two plays the seven of clubs and have the three of hearts in the hand, it is suppose show the message “play another”

@Override
    public boolean validCard(List<Card> hand, JTextField pn70, JTextField pn50, int i) {
        if(pn70.getText().equals (pn50.getText())) {
            System.out.println("you assist");
            return true;
        } else {
            if (hand.subList(0, 10).contains(pn50.getText())) {
                System.out.println("play another");
                }
            else 
                System.out.println(hand);
        }
        return false;
    }

any help?

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-05-19T22:43:43+00:00Added an answer on May 19, 2026 at 10:43 pm

    The easiest solution here is to just replace the call to contains with a loop:

    boolean contained = false;
    for (Card card : hand.subList(0, 10)) {
      if (card.suit().equals(pn50.getText()) {
        contained = true;
        break;
      }
    }
    
    if (contained) {
      // ...
    } else {
      // ...
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this jquery script which suppose to hide/show div element base on the
I have this script: select name,create_date,modify_date from sys.procedures order by modify_date desc I can
I have this .bat script which I use to maven package my application. Problem
Suppose I have this code : <head> <script type=text/javascript> func1(); </script> <script type=text/javascript src=jquery.js></script>
Ok, I have this script working 99% of how it should be working, but
Well basically I have this script that takes a long time to execute and
I have this Perl script with many defined constants of configuration files. For example:
I have this little script to toggle a contact form when a button is
I have this bit of script to widen a text box on mouseover and
I have this simple php script <?php echo '<pre>'; // Outputs all the result

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.