All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.google.gwt.thirdparty.xapi.collect.impl.StringStack Maven / Gradle / Ivy

The newest version!
package com.google.gwt.thirdparty.xapi.collect.impl;


public class StringStack  {
  
  public StringStack next;
  String prefix = "";
  T value;

  public StringStack push(String prefix, T b) {
    StringStack node = new StringStack();
    node.prefix = prefix == null ? "" : prefix;
    node.value = b;
    assert next == null : "Pushing to the same stack twice overwrites old value.";
    // Instead, just do tail = tail.push("", value);
    next = node;
    return node;
  }
  
  
  public T getValue() {
    return value;
  }

  public void setValue(T value) {
    this.value = value;
  }
  
  public void setPrefix(String prefix) {
    this.prefix = prefix;
  }
  
  @Override
  public final String toString() {
    return prefix + 
        (next == null ? toString(value) : toString(value) + next);
  }

  protected String toString(T item) {
    return item == null ? "" : item.toString();
  }
  
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy