Questions tagged [key-value]

A key-value pair is a set of two linked data items: a key which uniquely identifies some item of data, and the value, which is either the data that is identified or a pointer to the location of that data. Key-value pairs are frequently used in lookup tables, hash tables and configuration files.

A key-value pair is a set of two linked data items: a key which uniquely identifies some item of data, and the value, which is either the data that is identified or a pointer to the location of that data. Key-value pairs are frequently used in lookup tables, hash tables and configuration files.

http://searchenterprisedesktop.techtarget.com/definition/key-value-pair

A collection of key-value pairs is called an associative array.

The concept of key value pairs is applied in modern NoSQL databases for representing a storage mechanism. Key-Value is also a way to assign attributes and values to NSObject based instances in Cocoa framework (Related: Objective-C).

3201 questions
138
votes
3 answers

What's the purpose of Kafka's key/value pair-based messaging?

All of the examples of Kafka | producers show the ProducerRecord's key/value pair as not only being the same type (all examples show ), but the same value. For example: producer.send(new ProducerRecord("someTopic",…
smeeb
  • 27,777
  • 57
  • 250
  • 447
125
votes
19 answers

How to set dynamic values with Kubernetes yaml file

For example, a deployment yaml file: apiVersion: extensions/v1beta1 kind: Deployment metadata: name: guestbook spec: replicas: 2 template: metadata: labels: app: guestbook spec: container: - name:…
online
  • 4,919
  • 10
  • 32
  • 47
110
votes
4 answers

How can I get key's value from dictionary in Swift?

I have a Swift dictionary. I want to get my key's value. Object for key method is not working for me. How do you get the value for a dictionary's key? This is my dictionary: var companies = ["AAPL" : "Apple Inc", "GOOG" : "Google Inc", "AMZN" :…
DuyguK
  • 4,250
  • 9
  • 33
  • 46
109
votes
5 answers

How to push both key and value into an Array in Jquery

I am reading RSS feed and pushing both Title and Link into an Array in Jquery. What i did is var arr = []; $.getJSON("displayjson.php",function(data){ $.each(data.news, function(i,news){ var title =…
KillerFish
  • 5,042
  • 16
  • 55
  • 64
104
votes
4 answers

What's the difference between std::multimap and std::map >

I found that they have one key and multiple values which is unique.
superK
  • 3,932
  • 6
  • 30
  • 54
103
votes
7 answers

How to modify a KeyValuePair value?

I got a problem when I try to modify the value of an item because its only a read only field. KeyValuePair I've tried different alternatives like: Dictionary but there I have the same problem. Is there a way to set the…
Kimbo
  • 1,328
  • 3
  • 9
  • 12
91
votes
6 answers

Can't access cookies from document.cookie in JS, but browser shows cookies exist

I can't access any cookie from JavaScript. I need to read some value and send them via JSON for my custom checks. I've tried to access cookies from JS, like it was described at: http://www.w3schools.com/js/js_cookies.asp Get cookie by name As you…
user2402179
87
votes
5 answers

C# Dictionary get item by index

I am trying to make a method that returns a name of a card from my Dictionary randomly. My Dictionary: First defined name of the card which is string and second is the value of that card, which is int. public static Dictionary _dict =…
Jakub Staněk
  • 1,023
  • 1
  • 10
  • 11
85
votes
7 answers

What is difference between const and non const key?

What is the difference between the following two lines? map map_data; map map_data;
NullPoiиteя
  • 56,591
  • 22
  • 125
  • 143
81
votes
7 answers

Go map of functions

I have Go program that has a function defined. I also have a map that should have a key for each function. How can I do that? I have tried this, but this doesn't work. func a(param string) { } m := map[string] func { 'a_func': a, } for key,…
Conceited Code
  • 4,517
  • 3
  • 29
  • 32
61
votes
5 answers

Iterate through dictionary values?

Hey everyone I'm trying to write a program in Python that acts as a quiz game. I made a dictionary at the beginning of the program that contains the values the user will be quizzed on. Its set up like so: PIX0 = {"QVGA":"320x240", "VGA":"640x480",…
Ben Williams
  • 745
  • 1
  • 5
  • 9
55
votes
2 answers

Typescript array of key value pairs declaration

Confused about the following declaration: constructor(controls: {[key: string]: AbstractControl}, optionals?: {[key: string]: boolean}, validator?: ValidatorFn, asyncValidator?: AsyncValidatorFn) What is the type of the controls (first…
mishap
  • 8,176
  • 14
  • 61
  • 92
55
votes
10 answers

parsing .properties file in Python

The ConfigParser module raises an exception if one parses a simple Java-style .properties file, whose content is key-value pairs (i..e without INI-style section headers). Is there some workaround?
tshepang
  • 12,111
  • 21
  • 91
  • 136
52
votes
5 answers

Tuple list from dict in Python

How can I obtain a list of key-value tuples from a dict in Python?
Manuel Araoz
  • 15,962
  • 24
  • 71
  • 95
50
votes
8 answers

Can't add keyValuePair directly to Dictionary

I wanted to add a KeyValuePair to a Dictionary and I couldn't. I have to pass the key and the value separately, which must mean the Add method has to create a new KeyValuePair object to insert, which can't be very efficient. I can't…
Dave
  • 3,429
  • 2
  • 26
  • 29