This QueueStackUtil class tests various usages of the Queue interface and Stack classes
param1 is a string. You will push each of its characters onto a stack, then as you pop 
off the characters, you will compare them to to the characters of th string in forward 
order. If ALL the characters match, you will return true because the string is a 
palindrome, oherwise you will return false.
QueueStackUtil.java
import java.util.LinkedList;
import java.util.Queue;
import java.util.Stack;
/**
This QueueStackUtil class tests various usages of the Queue interface and Stack classes
param1 is a string. You will push each of its characters onto a stack, then as you pop
off the characters, you will compare them to to the characters of th string in forward
order. If ALL the characters match, you will return true because the string is a
palindrome, oherwise you will return false.
*/
public class QueueStackUtil
{
public static boolean check(String str)
{
// TODO: create a Character class stack named stack and push each char of the
// string onto it
return processStack(stack, str);
}
public static boolean processStack(Stack<Character> stack, String str)
{
int count = stack.size();
for (int i = 0; i < count; i++)
{
// TODO: check if pop of stack does not match the ith string char
// return false in that case
}
return true;
}
}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
CodeCheckReset