ColdFusion is built on top of Java; and it has plumbing to access Java classes. This is pretty cool. That means we can extend ColdFusion's capability.
Here is an example on how to utilize Java's Stack class. What we need to do is to create an object from Java class in question. Here, we created a Stack. As you can see, we can immediately call and utilize its methods.
<cfset objStack = CreateObject("java","java.util.Stack").init() /> <cfdump var="#objStack#" /> <cfdump var="#objStack.empty()#" /> <cfset objStack.push("a") /> <cfset objStack.push("b") /> <cfset objStack.push("c") /> <cfdump var="#objStack.empty()#" /> <cfdump var="#objStack.peek()#" /> <!--- The top element is always one ---> <cfdump var="#objStack.search('c')#" />
NOTE: Often, when we work with electronic payments, the third-party may require us to use certain algorithm for encryption. In this case, Java has more options to choose from than the ones already built in ColdFusion. So, take advantage of Java classes.Reference: