Best code examples for Java 8 Stack class (java.util.Stack)

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 Stack class.
You can now enable Codota on your own code to easily search and navigate your Java codebase.

Java 8 Stack examples from Open Source projects
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
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
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
This code example shows how to use the following methods:
     
  /** Creates a new instance of XmlRecordOutput */ 
  public XmlRecordOutput(OutputStream out) {
    try { 
      stream = new PrintStream(out, true, "UTF-8");
      compoundStack = new Stack<String>();
    } catch (UnsupportedEncodingException ex) {
      throw new RuntimeException(ex);
    } 
  } 
     
  @Override 
  public void writeByte(byte b, String tag) throws IOException {
    printBeginEnvelope(tag);
    stream.print("<ex:i1>");
    stream.print(Byte.toString(b));
    stream.print("</ex:i1>");
    printEndEnvelope(tag);
  } 
     
Full Snippet Info
9
CodeRank
This code example shows how to use the following methods: peek
  } 
 
  protected void manageTypes(final String iFieldName, final Object iFieldValue) {
    if (settings.keepTypes) {
      if (iFieldValue instanceof Long)
        appendType(typesStack.peek(), iFieldName, 'l');
      else if (iFieldValue instanceof Float)
        appendType(typesStack.peek(), iFieldName, 'f');
      else if (iFieldValue instanceof Short)
        appendType(typesStack.peek(), iFieldName, 's');
      else if (iFieldValue instanceof Double)
        appendType(typesStack.peek(), iFieldName, 'd');
      else if (iFieldValue instanceof Date)
        appendType(typesStack.peek(), iFieldName, 't');
      else if (iFieldValue instanceof Byte || iFieldValue instanceof byte[])
        appendType(typesStack.peek(), iFieldName, 'b');
      else if (iFieldValue instanceof BigDecimal)
        appendType(typesStack.peek(), iFieldName, 'c');
      else if (iFieldValue instanceof Set<?>)
        appendType(typesStack.peek(), iFieldName, 'e');
Full Snippet Info
9
CodeRank
Related Java 8 Stack Questions & Answers:
See Code Examples for Java 8 Stack Methods: