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).

1  
sclass StringWithMeta > Meta is CharSequence {
2  
  S string; // final. not null
3  
  
4  
  *() {}
5  
  *(S *string) { assertNotNull(string); }
6  
  
7  
  public int hashCode() { ret _hashCode(string); }
8  
  public bool equals(O o) { ret this == o; }
9  
  
10  
  // This drops the meta
11  
  toString { ret string; }
12  
  
13  
  // implementation of CharSequence methods
14  
  
15  
  public int length() { ret string.length(); }
16  
  public char charAt(int index) { ret string.charAt(index); }
17  
  
18  
  // could change to retain meta
19  
  public CharSequence subSequence(int start, int end) {
20  
    ret string.substring(start, end);
21  
  }
22  
}

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: 109 / 177
Version history: 3 change(s)
Referenced in: [show references]