Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

22
LINES

< > BotCompany Repo | #1034063 // StringWithMeta

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (4825L/28K).

sclass StringWithMeta > Meta is CharSequence {
  S string; // final. not null
  
  *() {}
  *(S *string) { assertNotNull(string); }
  
  public int hashCode() { ret _hashCode(string); }
  public bool equals(O o) { ret this == o; }
  
  // This drops the meta
  toString { ret string; }
  
  // implementation of CharSequence methods
  
  public int length() { ret string.length(); }
  public char charAt(int index) { ret string.charAt(index); }
  
  // could change to retain meta
  public CharSequence subSequence(int start, int end) {
    ret string.substring(start, end);
  }
}

Author comment

Began life as a copy of #1012685

download  show line numbers  debug dex  old transpilations   

Travelled to 4 computer(s): bhatertpkbcr, ekrmjmnbrukm, mowyntqkapby, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1034063
Snippet name: StringWithMeta
Eternal ID of this version: #1034063/4
Text MD5: b5095512765d0c886b1c5eb37eaa2efd
Transpilation MD5: e73662c39afa37729b489d3ad04c9c13
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-01-20 00:43:47
Source code size: 601 bytes / 22 lines
Pitched / IR pitched: No / No
Views / Downloads: 54 / 99
Version history: 3 change(s)
Referenced in: [show references]