Java 8 Stack - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 Stack class.

This code example shows how to use the following methods:
    public TagContext(String tagName) {
        this.tagName = tagName;
    } 
     
    public static void init() { 
        currentStack.set(new Stack<TagContext>());
        enterTag("ROOT"); 
    } 
     
    public static void enterTag(String name) {
        currentStack.get().add(new TagContext(name));
    } 
     
    public static void exitTag() { 
        currentStack.get().pop();
    } 
     
    public static TagContext current() { 
        return currentStack.get().peek();
    } 
Full Snippet Info
10
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods:
   
  @Override 
  public void startDocument() { 
    state = ParseState.EXPECT_EDITS_TAG;
    stanza = null;
    stanzaStack = new Stack<Stanza>();
    opCode = null;
    cbuf = new StringBuffer();
    nextTxId = -1;
  } 
   
  @Override 
  public void endDocument() { 
    if (state != ParseState.EXPECT_END) {
      throw new InvalidXmlException("expecting </EDITS>"); 
    } 
  } 
   
  @Override 
  public void startElement (String uri, String name,
Full Snippet Info
9
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: peek
 
        return variable;
    } 
 
    public static Expression getInstance() { 
        return instance.get().peek();
    } 
 
    private void pushInstance() { 
        Stack<Expression> foo = instance.get();
        if (foo == null) {
            instance.set(foo = new Stack<Expression>());
        } 
 
        foo.push(this);
    } 
 
    private void popInstance() { 
        Stack<Expression> foo = instance.get();
 
Full Snippet Info
9
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: push
    } 
    return large;
  } 
   
  private Stack<String> createStack() {
    Stack<String> stack = new Stack<String>();
    stack.push("1");
    stack.push("2");
    stack.push("3");
    return stack;
  } 
 
  /** Checks for emptiness of stack by peeking and popping. */ 
  private void checkEmptiness(Stack<?> s) {
    assertTrue(s.empty());
    try { 
      s.pop();
      fail("Did not throw exception on pop of checkEmptiness"); 
    } catch (EmptyStackException es) {
      try { 
Full Snippet Info
8
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: peek, pop
  public void characters(char[] chars, int start, int length) throws SAXException {
    charBuffer.append(chars, start, length);
  } 
 
  public void endElement(String uri, String localName, String qName) throws SAXException {
    Node previousNode = ((Node)nodesStack.peek());
    previousNode.setValue(charBuffer.toString());
    charBuffer.setLength(0);
    Node node = (Node)nodesStack.pop();
    node.complete();
  } 
} 
Full Snippet Info
8
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE

Related Java 8 Stack Questions & Answers:

See Code Examples for Java 8 Stack Methods: