i wrote a function which uses set.my function is
public static Set<Schema.DisplayType> giveSchemaSet(Set<String> x){
Set<Schema.DisplayType> displayCompatibleSet = new Set<Schema.DisplayType>();
Map<String,Schema.DisplayType> displayTypeMap = new Map<String,Schema.DisplayType>{
'boolean' => Schema.DisplayType.Boolean,
'currency' => Schema.DisplayType.Currency,
'date' => Schema.DisplayType.Date,
'datetime' => Schema.DisplayType.DateTime,
'double' => Schema.DisplayType.Double,
'email' => Schema.DisplayType.Email,
'encryptedstring' => Schema.DisplayType.EncryptedString,
'integer' => Schema.DisplayType.Integer,
'multipicklist' => Schema.DisplayType.MultiPickList,
'percent' => Schema.DisplayType.Percent,
'phone' => Schema.DisplayType.Phone,
'picklist'=> Schema.DisplayType.Picklist,
'reference'=>Schema.DisplayType.Reference,
'string' =>Schema.DisplayType.String,
'textarea' =>Schema.DisplayType.TextArea,
'time' => Schema.DisplayType.Time,
'url' => Schema.DisplayType.URL
};
System.debug('x is '+x);
for(String displayType:x)
{
System.debug('displayType is:' + displayTypeMap.get(displayType));
displayCompatibleSet.add(displayTypeMap.get(displayType));
}
System.debug('displayCompatibleSet is'+displayCompatibleSet);
return displayCompatibleSet;
}
in debug log
x is {boolean, picklist, string, textarea}
displayCompatibleSet is{BOOLEAN}
in argument i am passing 4 elements but in displayCompatibleSet.it should also be of 4 length but it contains only one element .can anyone please explain this behaviour.