generated from microsoft/vscode-remote-try-java
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
46 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
src/main/java/com/mycompany/app/Sequence/SequenceAnonymous.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package com.mycompany.app.Sequence; | ||
|
||
public class SequenceAnonymous { | ||
// array of Object | ||
private Object [] obj; | ||
private int next = 0; | ||
private int size; | ||
|
||
SequenceAnonymous(){} | ||
|
||
public SequenceAnonymous(int size){ | ||
obj = new Object[size]; | ||
} | ||
//set content | ||
public void add(Object x){ | ||
if(next<obj.length) {obj[next] = x; next ++;} | ||
} | ||
//inner class of Subsequence | ||
|
||
|
||
public SelectorA getSelector(){ | ||
return new SelectorA(){ | ||
int i = 0; | ||
|
||
@Override | ||
public boolean end() { | ||
return i == obj.length; | ||
} | ||
|
||
@Override | ||
public Object current() { | ||
return obj[i]; | ||
} | ||
|
||
@Override | ||
public void next() { | ||
if(i<obj.length) i++; | ||
} | ||
}; | ||
} | ||
|
||
//anonymous Inner Class | ||
|
||
} |