Is the field describe result map a special type of Map?
I read in Accessing All Field Describe Results for an sObject:
Use the field describe result's getMap method to return a map that
represents the relationship between all the field names (keys) and the
field tokens (values) for an sObject.
Map<String, Schema.SObjectField> fieldMap = Schema.SObjectType.Account.fields.getMap();
The map has the following characteristics:
All field names are case insensitive.
While the documentation for Maps says:
Map keys of type String are case-sensitive.
QUESTION
Is the field describe result map a special type of Map? It's quite frustrating to have one type of Map in apex to behave differently.
apex map
add a comment |
I read in Accessing All Field Describe Results for an sObject:
Use the field describe result's getMap method to return a map that
represents the relationship between all the field names (keys) and the
field tokens (values) for an sObject.
Map<String, Schema.SObjectField> fieldMap = Schema.SObjectType.Account.fields.getMap();
The map has the following characteristics:
All field names are case insensitive.
While the documentation for Maps says:
Map keys of type String are case-sensitive.
QUESTION
Is the field describe result map a special type of Map? It's quite frustrating to have one type of Map in apex to behave differently.
apex map
1
Possible duplicate: salesforce.stackexchange.com/q/102302/2995
– Adrian Larson♦
Dec 15 at 22:48
add a comment |
I read in Accessing All Field Describe Results for an sObject:
Use the field describe result's getMap method to return a map that
represents the relationship between all the field names (keys) and the
field tokens (values) for an sObject.
Map<String, Schema.SObjectField> fieldMap = Schema.SObjectType.Account.fields.getMap();
The map has the following characteristics:
All field names are case insensitive.
While the documentation for Maps says:
Map keys of type String are case-sensitive.
QUESTION
Is the field describe result map a special type of Map? It's quite frustrating to have one type of Map in apex to behave differently.
apex map
I read in Accessing All Field Describe Results for an sObject:
Use the field describe result's getMap method to return a map that
represents the relationship between all the field names (keys) and the
field tokens (values) for an sObject.
Map<String, Schema.SObjectField> fieldMap = Schema.SObjectType.Account.fields.getMap();
The map has the following characteristics:
All field names are case insensitive.
While the documentation for Maps says:
Map keys of type String are case-sensitive.
QUESTION
Is the field describe result map a special type of Map? It's quite frustrating to have one type of Map in apex to behave differently.
apex map
apex map
asked Dec 15 at 9:16
Eduard
1,8151522
1,8151522
1
Possible duplicate: salesforce.stackexchange.com/q/102302/2995
– Adrian Larson♦
Dec 15 at 22:48
add a comment |
1
Possible duplicate: salesforce.stackexchange.com/q/102302/2995
– Adrian Larson♦
Dec 15 at 22:48
1
1
Possible duplicate: salesforce.stackexchange.com/q/102302/2995
– Adrian Larson♦
Dec 15 at 22:48
Possible duplicate: salesforce.stackexchange.com/q/102302/2995
– Adrian Larson♦
Dec 15 at 22:48
add a comment |
1 Answer
1
active
oldest
votes
In the object oriented "is a" sense, at least at compile time, they both support these Map methods. But the implementing class might be this for the describe map:
Map<String, String> m = new TreeMap<String, String>(String.CASE_INSENSITIVE_ORDER);
and this for most other maps:
Map<String, String> m = new HashMap<String, String>();
Other languages would make the distinction between interface and implementation a bit clearer by providing the contract (the methods) in an interface.
I agree being case insensitive in some places but not in others can be confusing.
3
+1 It'd be incredibly nice if they gave us the option to write case-insensitive maps without writing an entire wrapper class dedicated to that purpose.
– sfdcfox
Dec 15 at 12:51
@sfdcfox Agreed. Or Generic types so you don't have to keep re-implementing for various types.
– Keith C
Dec 15 at 12:53
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "459"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsalesforce.stackexchange.com%2fquestions%2f242702%2fis-the-field-describe-result-map-a-special-type-of-map%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
In the object oriented "is a" sense, at least at compile time, they both support these Map methods. But the implementing class might be this for the describe map:
Map<String, String> m = new TreeMap<String, String>(String.CASE_INSENSITIVE_ORDER);
and this for most other maps:
Map<String, String> m = new HashMap<String, String>();
Other languages would make the distinction between interface and implementation a bit clearer by providing the contract (the methods) in an interface.
I agree being case insensitive in some places but not in others can be confusing.
3
+1 It'd be incredibly nice if they gave us the option to write case-insensitive maps without writing an entire wrapper class dedicated to that purpose.
– sfdcfox
Dec 15 at 12:51
@sfdcfox Agreed. Or Generic types so you don't have to keep re-implementing for various types.
– Keith C
Dec 15 at 12:53
add a comment |
In the object oriented "is a" sense, at least at compile time, they both support these Map methods. But the implementing class might be this for the describe map:
Map<String, String> m = new TreeMap<String, String>(String.CASE_INSENSITIVE_ORDER);
and this for most other maps:
Map<String, String> m = new HashMap<String, String>();
Other languages would make the distinction between interface and implementation a bit clearer by providing the contract (the methods) in an interface.
I agree being case insensitive in some places but not in others can be confusing.
3
+1 It'd be incredibly nice if they gave us the option to write case-insensitive maps without writing an entire wrapper class dedicated to that purpose.
– sfdcfox
Dec 15 at 12:51
@sfdcfox Agreed. Or Generic types so you don't have to keep re-implementing for various types.
– Keith C
Dec 15 at 12:53
add a comment |
In the object oriented "is a" sense, at least at compile time, they both support these Map methods. But the implementing class might be this for the describe map:
Map<String, String> m = new TreeMap<String, String>(String.CASE_INSENSITIVE_ORDER);
and this for most other maps:
Map<String, String> m = new HashMap<String, String>();
Other languages would make the distinction between interface and implementation a bit clearer by providing the contract (the methods) in an interface.
I agree being case insensitive in some places but not in others can be confusing.
In the object oriented "is a" sense, at least at compile time, they both support these Map methods. But the implementing class might be this for the describe map:
Map<String, String> m = new TreeMap<String, String>(String.CASE_INSENSITIVE_ORDER);
and this for most other maps:
Map<String, String> m = new HashMap<String, String>();
Other languages would make the distinction between interface and implementation a bit clearer by providing the contract (the methods) in an interface.
I agree being case insensitive in some places but not in others can be confusing.
edited Dec 15 at 10:19
answered Dec 15 at 10:08
Keith C
94.2k1089201
94.2k1089201
3
+1 It'd be incredibly nice if they gave us the option to write case-insensitive maps without writing an entire wrapper class dedicated to that purpose.
– sfdcfox
Dec 15 at 12:51
@sfdcfox Agreed. Or Generic types so you don't have to keep re-implementing for various types.
– Keith C
Dec 15 at 12:53
add a comment |
3
+1 It'd be incredibly nice if they gave us the option to write case-insensitive maps without writing an entire wrapper class dedicated to that purpose.
– sfdcfox
Dec 15 at 12:51
@sfdcfox Agreed. Or Generic types so you don't have to keep re-implementing for various types.
– Keith C
Dec 15 at 12:53
3
3
+1 It'd be incredibly nice if they gave us the option to write case-insensitive maps without writing an entire wrapper class dedicated to that purpose.
– sfdcfox
Dec 15 at 12:51
+1 It'd be incredibly nice if they gave us the option to write case-insensitive maps without writing an entire wrapper class dedicated to that purpose.
– sfdcfox
Dec 15 at 12:51
@sfdcfox Agreed. Or Generic types so you don't have to keep re-implementing for various types.
– Keith C
Dec 15 at 12:53
@sfdcfox Agreed. Or Generic types so you don't have to keep re-implementing for various types.
– Keith C
Dec 15 at 12:53
add a comment |
Thanks for contributing an answer to Salesforce Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsalesforce.stackexchange.com%2fquestions%2f242702%2fis-the-field-describe-result-map-a-special-type-of-map%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
Possible duplicate: salesforce.stackexchange.com/q/102302/2995
– Adrian Larson♦
Dec 15 at 22:48