Questions tagged [containskey]
80 questions
1
vote
3 answers
Why containsKey did not find the key?
I have the following code:
payoffs2exchanges.put(point, exchange);
if (!payoffs2exchanges.containsKey(point) ) {
game.log.fine("yes");
} else {
game.log.fine("no");
}
It outputs "no". In other words, I add the key-value pair to the map, and…

Roman
- 124,451
- 167
- 349
- 456
1
vote
2 answers
ContainsKey in dictionary of hashset
I have a dictionary:
Dictionary, List> myDict = ...
And I have:
HashSet myHashSet = ...
I want to check if the dictionary (myDict) contains myHashSet.
I tried to override two methods:
1) equal
2) GetHashCode
public…

Maor Cohen
- 936
- 2
- 18
- 33
1
vote
1 answer
Java - containsKey() on HashMap returning null - is it checking for the exact object rather than just a matching key?
I've got a HashMap of Integer[], Integer[]. One of the entries is:
WEIGHTS.put(new Integer[]{0,0,0,0,0}, new Integer[]{20,20,15,15,10,10,5,5});
I then call:
probabilities = WEIGHTS.get(sheriffAndBanditPositions);
where sheriffAndBanditPositions…

James
- 749
- 1
- 9
- 22
1
vote
0 answers
Steps to implement thesaurus in oracle
Can anyone help me with steps for how to implement thesaurus search in oracle 11g.
I have read the oracle text document but it was of no help.

ankit jain
- 21
- 1
1
vote
1 answer
Encoding Path to URI behaves differently when built into JAR or not
I have a call to a HashMap's containsKey method that I expect to return true. It returns true if I compile my program to .class files and run it like that, but if I build a JAR then the same call returns false for reasons I cannot comprehend.
I've…
user3448408
1
vote
3 answers
Dictionary is returning false on ContainsKey after item is added
I have a dictionary declared as follows
IDictionary _objectIds = new Dictionary();
I was experiencing some problems with it and it discovered that the instance returned false as a result of ContainsKey method and…

Karel Frajták
- 4,389
- 1
- 23
- 34
1
vote
3 answers
Java - HashMap.containsKey returning incorrect values for Objects
Here is my code:
import java.util.HashMap;
class MyString
{
String string;
MyString(String string)
{
this.string = new String(string);
}
}
public class test
{
public void test3()
{
HashMap byteHashMap = new…

Danny Rancher
- 1,923
- 3
- 24
- 43
1
vote
2 answers
Dictionary using is custom key but key is always unequal
I am using RTBTextPointer as custom key in dictionary...
Init.SpintaxEditorPropertyMain.SpintaxListDict = new Dictionary(new RTBTextPointerComparer());
I worte this RTBTextPointer, and…

Jay
- 33
- 5
1
vote
1 answer
Java TreeMap containsKey invariably returning true?
I'm writing a Java program that's using the TreeMap interface, and I'm having a problem with containsKey. It is returning true even when I give containsKey something that I know for certain is not in the TreeMap.
What could be the cause of…

Jenny
- 123
- 2
- 7
1
vote
2 answers
Java Hash Map containsKey is returning true when it should not
So I have this method that adds an object to a display. When the display is first opened all of the existing objects get added in to the HashMap 1 by 1. After that the user can add more, 1 at a time which puts a new object into the HashMap.
the…

user1855475
- 21
- 4
0
votes
1 answer
update values in a dictionary with new fields obtained from a wmi query vb.net
EDIT
I still can't assign the process the username of the session id that is associated with it.
This is the code i use to retrieve user details:
Public Sub GetUsers()
Using server As ITerminalServer = manager.GetRemoteServer(strHostName)
…

A Smith
- 251
- 2
- 4
- 10
0
votes
2 answers
How to use startsWith or contains method with string or string array?
My address as string contains this details
String address = "S/O: KANTH MEIPPEN PACHU, N-2345, THAMBULI";
Here masking to be implemented for the above mentioned address line in below format
if the address line starts with S/O, D/O, W/O, C/O it…

Priyadharshini
- 3
- 2
0
votes
0 answers
Incorrect definition of user type
I have a class that determines the user type
public class Auth
{
public enum UserType : ushort
{
Admin = 0,
User = 1,
None = 2,
}
public UserType userType =…

Lord Skr
- 1
0
votes
0 answers
Why map.containsKey(object) doesn't works when refresh page on Flutter web?
Currently i have a cart application and use hive package to save data cart on memory.
When i use normally the app, the quantity of cart show properly grouped.
These is the code for deduplicate the items and show their quantity grouped
Map…

shroot91
- 41
- 1
- 4
0
votes
1 answer