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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T12:52:14+00:00 2026-06-09T12:52:14+00:00

While performing the following: ImmutableMultimap<Something, Something> map; //Say I insert Hello, 5 to the

  • 0

While performing the following:

ImmutableMultimap<Something, Something> map;
//Say I insert "Hello", "5" to the map
System.out.println(map.keys().toString());

This prints [Hello] So when I do

if(map.keys().toString().equals("Hello"))

it always fails. I don’t want to do

if(map.keys().toString.equals("[Hello]")

Is there a way to display the result without the square brackets?

  • 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-09T12:52:15+00:00Added an answer on June 9, 2026 at 12:52 pm

    You should never ever use toString() for anything serious! This method is meant for people inspecting what’s going on (e.g. in debugger) and for nothing else.

    Moreover, there are no brackets there in. map.keys() is a collection and it’s toString() method works like it should for collections. You’d better replace your test by testing map.keys.size() == 1 and then checking the only element.

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

Sidebar

Related Questions

I'm performing a while loop in C#, this is going through some records being
I get the following error while performing the following commmand of adding rubygems.orgs as
I am getting the following error from some users while performing a lightweight Core
The following method shows up as leaking while performing a memory-leaks test with Instruments:
I'm working with a smallish type hierarchy, something like the following, and lets say
While performing a conditional DELETE operation in one of my InnoDB tables, which apparently
While performing some upcoming maintenance, I'm going to have to redirect all site traffic
I have noticed stange things while performing tests. The stange things concern character encoding.
Is there a way to show the SQL that Django is running while performing
I have a SQL database and i am performing the following query on 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.