Can I create an Apex.Stack for any type?
Clash Royale CLAN TAG#URR8PPP
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty margin-bottom:0;
up vote
4
down vote
favorite
Can I create an Apex.Stack
for any type?
If I will do:
Apex.Stack stackForIds = new Apex.Stack();
Then I am able to put id values in such a stack:
stackForIds.push(anId);
Here is how I tried to put an SObject
into my stack:
Apex.Stack<SObject> stackForSObjects= new Apex.Stack<SObject>();
stackForSObjects.push(new SObject(Id = anId));
And it did not work out. I am getting an error:
Cannot resolve symbol
Apex.Stack<SObject>
There seems to be no documentation on the Apex.Stack
, so I would be grateful for it. Otherwise I am asking for help to figure out whether or not Apex.Stack
is able to work with an arbitrary type.
apex
add a comment |Â
up vote
4
down vote
favorite
Can I create an Apex.Stack
for any type?
If I will do:
Apex.Stack stackForIds = new Apex.Stack();
Then I am able to put id values in such a stack:
stackForIds.push(anId);
Here is how I tried to put an SObject
into my stack:
Apex.Stack<SObject> stackForSObjects= new Apex.Stack<SObject>();
stackForSObjects.push(new SObject(Id = anId));
And it did not work out. I am getting an error:
Cannot resolve symbol
Apex.Stack<SObject>
There seems to be no documentation on the Apex.Stack
, so I would be grateful for it. Otherwise I am asking for help to figure out whether or not Apex.Stack
is able to work with an arbitrary type.
apex
add a comment |Â
up vote
4
down vote
favorite
up vote
4
down vote
favorite
Can I create an Apex.Stack
for any type?
If I will do:
Apex.Stack stackForIds = new Apex.Stack();
Then I am able to put id values in such a stack:
stackForIds.push(anId);
Here is how I tried to put an SObject
into my stack:
Apex.Stack<SObject> stackForSObjects= new Apex.Stack<SObject>();
stackForSObjects.push(new SObject(Id = anId));
And it did not work out. I am getting an error:
Cannot resolve symbol
Apex.Stack<SObject>
There seems to be no documentation on the Apex.Stack
, so I would be grateful for it. Otherwise I am asking for help to figure out whether or not Apex.Stack
is able to work with an arbitrary type.
apex
Can I create an Apex.Stack
for any type?
If I will do:
Apex.Stack stackForIds = new Apex.Stack();
Then I am able to put id values in such a stack:
stackForIds.push(anId);
Here is how I tried to put an SObject
into my stack:
Apex.Stack<SObject> stackForSObjects= new Apex.Stack<SObject>();
stackForSObjects.push(new SObject(Id = anId));
And it did not work out. I am getting an error:
Cannot resolve symbol
Apex.Stack<SObject>
There seems to be no documentation on the Apex.Stack
, so I would be grateful for it. Otherwise I am asking for help to figure out whether or not Apex.Stack
is able to work with an arbitrary type.
apex
apex
edited Sep 9 at 14:03
Adrian Larsonâ¦
101k19107226
101k19107226
asked Sep 9 at 9:20
iloveseven
49516
49516
add a comment |Â
add a comment |Â
2 Answers
2
active
oldest
votes
up vote
5
down vote
accepted
As AFIK there is no such class in the platform's API, look in your own code base for a class called Apex
that has an inner class called Stack
.
If you want to support other types, you will have to add additional methods for those and generalize the implementation. Other languages include better mechanisms for this situation - see e.g. Java's Generic Types.
Though as this Apex.Stack
code probably does very little, changing the method signatures and implementation to use Object
rather than Id
would probably be the best way to go as then all types would be supported. But casts would be needed when values are popped.
Oh. That explains why I was not able to find the documentation onApex.Stack
.
â iloveseven
Sep 9 at 11:02
4
@iloveseven Yeah I'm a bit surprised you can even create a class calledApex
as it makes you think it is a platform feature.
â Keith C
Sep 9 at 11:37
Apex is not a recognised keyword, so I belive it should not cause compilation error. Which makes sense.
â Pranay Jaiswal
Sep 9 at 11:50
@PranayJaiswal You mean a reserved word ?
â Bennie
Sep 9 at 13:37
add a comment |Â
up vote
0
down vote
The Apex.Stack class has known limitations and bugs, which is why it was never formally released in the documentation. Do not use it if you care about the stability of your code.
add a comment |Â
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
5
down vote
accepted
As AFIK there is no such class in the platform's API, look in your own code base for a class called Apex
that has an inner class called Stack
.
If you want to support other types, you will have to add additional methods for those and generalize the implementation. Other languages include better mechanisms for this situation - see e.g. Java's Generic Types.
Though as this Apex.Stack
code probably does very little, changing the method signatures and implementation to use Object
rather than Id
would probably be the best way to go as then all types would be supported. But casts would be needed when values are popped.
Oh. That explains why I was not able to find the documentation onApex.Stack
.
â iloveseven
Sep 9 at 11:02
4
@iloveseven Yeah I'm a bit surprised you can even create a class calledApex
as it makes you think it is a platform feature.
â Keith C
Sep 9 at 11:37
Apex is not a recognised keyword, so I belive it should not cause compilation error. Which makes sense.
â Pranay Jaiswal
Sep 9 at 11:50
@PranayJaiswal You mean a reserved word ?
â Bennie
Sep 9 at 13:37
add a comment |Â
up vote
5
down vote
accepted
As AFIK there is no such class in the platform's API, look in your own code base for a class called Apex
that has an inner class called Stack
.
If you want to support other types, you will have to add additional methods for those and generalize the implementation. Other languages include better mechanisms for this situation - see e.g. Java's Generic Types.
Though as this Apex.Stack
code probably does very little, changing the method signatures and implementation to use Object
rather than Id
would probably be the best way to go as then all types would be supported. But casts would be needed when values are popped.
Oh. That explains why I was not able to find the documentation onApex.Stack
.
â iloveseven
Sep 9 at 11:02
4
@iloveseven Yeah I'm a bit surprised you can even create a class calledApex
as it makes you think it is a platform feature.
â Keith C
Sep 9 at 11:37
Apex is not a recognised keyword, so I belive it should not cause compilation error. Which makes sense.
â Pranay Jaiswal
Sep 9 at 11:50
@PranayJaiswal You mean a reserved word ?
â Bennie
Sep 9 at 13:37
add a comment |Â
up vote
5
down vote
accepted
up vote
5
down vote
accepted
As AFIK there is no such class in the platform's API, look in your own code base for a class called Apex
that has an inner class called Stack
.
If you want to support other types, you will have to add additional methods for those and generalize the implementation. Other languages include better mechanisms for this situation - see e.g. Java's Generic Types.
Though as this Apex.Stack
code probably does very little, changing the method signatures and implementation to use Object
rather than Id
would probably be the best way to go as then all types would be supported. But casts would be needed when values are popped.
As AFIK there is no such class in the platform's API, look in your own code base for a class called Apex
that has an inner class called Stack
.
If you want to support other types, you will have to add additional methods for those and generalize the implementation. Other languages include better mechanisms for this situation - see e.g. Java's Generic Types.
Though as this Apex.Stack
code probably does very little, changing the method signatures and implementation to use Object
rather than Id
would probably be the best way to go as then all types would be supported. But casts would be needed when values are popped.
edited Sep 9 at 10:31
answered Sep 9 at 10:25
Keith C
91.2k1084189
91.2k1084189
Oh. That explains why I was not able to find the documentation onApex.Stack
.
â iloveseven
Sep 9 at 11:02
4
@iloveseven Yeah I'm a bit surprised you can even create a class calledApex
as it makes you think it is a platform feature.
â Keith C
Sep 9 at 11:37
Apex is not a recognised keyword, so I belive it should not cause compilation error. Which makes sense.
â Pranay Jaiswal
Sep 9 at 11:50
@PranayJaiswal You mean a reserved word ?
â Bennie
Sep 9 at 13:37
add a comment |Â
Oh. That explains why I was not able to find the documentation onApex.Stack
.
â iloveseven
Sep 9 at 11:02
4
@iloveseven Yeah I'm a bit surprised you can even create a class calledApex
as it makes you think it is a platform feature.
â Keith C
Sep 9 at 11:37
Apex is not a recognised keyword, so I belive it should not cause compilation error. Which makes sense.
â Pranay Jaiswal
Sep 9 at 11:50
@PranayJaiswal You mean a reserved word ?
â Bennie
Sep 9 at 13:37
Oh. That explains why I was not able to find the documentation on
Apex.Stack
.â iloveseven
Sep 9 at 11:02
Oh. That explains why I was not able to find the documentation on
Apex.Stack
.â iloveseven
Sep 9 at 11:02
4
4
@iloveseven Yeah I'm a bit surprised you can even create a class called
Apex
as it makes you think it is a platform feature.â Keith C
Sep 9 at 11:37
@iloveseven Yeah I'm a bit surprised you can even create a class called
Apex
as it makes you think it is a platform feature.â Keith C
Sep 9 at 11:37
Apex is not a recognised keyword, so I belive it should not cause compilation error. Which makes sense.
â Pranay Jaiswal
Sep 9 at 11:50
Apex is not a recognised keyword, so I belive it should not cause compilation error. Which makes sense.
â Pranay Jaiswal
Sep 9 at 11:50
@PranayJaiswal You mean a reserved word ?
â Bennie
Sep 9 at 13:37
@PranayJaiswal You mean a reserved word ?
â Bennie
Sep 9 at 13:37
add a comment |Â
up vote
0
down vote
The Apex.Stack class has known limitations and bugs, which is why it was never formally released in the documentation. Do not use it if you care about the stability of your code.
add a comment |Â
up vote
0
down vote
The Apex.Stack class has known limitations and bugs, which is why it was never formally released in the documentation. Do not use it if you care about the stability of your code.
add a comment |Â
up vote
0
down vote
up vote
0
down vote
The Apex.Stack class has known limitations and bugs, which is why it was never formally released in the documentation. Do not use it if you care about the stability of your code.
The Apex.Stack class has known limitations and bugs, which is why it was never formally released in the documentation. Do not use it if you care about the stability of your code.
answered Sep 10 at 0:02
sfdcfox
229k10176390
229k10176390
add a comment |Â
add a comment |Â
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
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsalesforce.stackexchange.com%2fquestions%2f231754%2fcan-i-create-an-apex-stack-for-any-type%23new-answer', 'question_page');
);
Post as a guest
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
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
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