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

51
LINES

< > BotCompany Repo | #1012666 // Collection to List Notification Methods (Include) with A instead of E

JavaX fragment (include)

1  
  public boolean equals(Object o) {
2  
      if (this == o)
3  
          return true;
4  
      synchronized (this) {return list.equals(o);}
5  
  }
6  
  public int hashCode() {
7  
      synchronized (this) {return list.hashCode();}
8  
  }
9  
10  
  public A get(int index) {
11  
      synchronized (this) {return list.get(index);}
12  
  }
13  
  public A set(int index, A element) {
14  
    synchronized (this) { beforeChange(); A a = list.set(index, element); change(); ret a; }
15  
  }
16  
  public void add(int index, A element) {
17  
    synchronized (this) { beforeChange(); list.add(index, element);} change();
18  
  }
19  
  public A remove(int index) {
20  
    A e;
21  
    synchronized (this) { beforeChange(); e = list.remove(index); }
22  
    change();
23  
    ret e;
24  
  }
25  
26  
  public int indexOf(Object o) {
27  
      synchronized (this) {return list.indexOf(o);}
28  
  }
29  
  public int lastIndexOf(Object o) {
30  
      synchronized (this) {return list.lastIndexOf(o);}
31  
  }
32  
33  
  public boolean addAll(int index, Collection<? extends A> c) {
34  
    synchronized (this) { beforeChange(); if (!list.addAll(index, c)) false;} change(); true;
35  
  }
36  
37  
  public ListIterator<A> listIterator() {
38  
      return list.listIterator(); // doesn't implement all methods
39  
  }
40  
41  
  public ListIterator<A> listIterator(int index) {
42  
      return list.listIterator(index); // doesn't implement all methods
43  
  }
44  
45  
  /*public void replaceAll(UnaryOperator<A> operator) {
46  
      synchronized (this) {list.replaceAll(operator);}
47  
  }*/
48  
  
49  
  public void sort(Comparator<? super A> c) {
50  
    synchronized (this) { beforeChange(); list.sort(c);} change();
51  
  }

Author comment

Began life as a copy of #1011344

download  show line numbers  debug dex  old transpilations   

Travelled to 16 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mowyntqkapby, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt, wnsclhtenguj

No comments. add comment

Snippet ID: #1012666
Snippet name: Collection to List Notification Methods (Include) with A instead of E
Eternal ID of this version: #1012666/5
Text MD5: 39d3bc081b034419be578201c3b24b2f
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-02-13 18:30:50
Source code size: 1579 bytes / 51 lines
Pitched / IR pitched: No / No
Views / Downloads: 362 / 1209
Version history: 4 change(s)
Referenced in: [show references]