< prev index next >
src/java.desktop/share/classes/javax/swing/text/SegmentCache.java
Print this page
*** 26,37 ****
import java.util.ArrayList;
import java.util.List;
/**
! * SegmentCache caches <code>Segment</code>s to avoid continually creating
! * and destroying of <code>Segment</code>s. A common use of this class would
* be:
* <pre>
* Segment segment = segmentCache.getSegment();
* // do something with segment
* ...
--- 26,37 ----
import java.util.ArrayList;
import java.util.List;
/**
! * SegmentCache caches {@code Segment}s to avoid continually creating
! * and destroying of {@code Segment}s. A common use of this class would
* be:
* <pre>
* Segment segment = segmentCache.getSegment();
* // do something with segment
* ...
*** 58,76 ****
return sharedCache;
}
/**
* A convenience method to get a Segment from the shared
! * <code>SegmentCache</code>.
*/
public static Segment getSharedSegment() {
return getSharedInstance().getSegment();
}
/**
* A convenience method to release a Segment to the shared
! * <code>SegmentCache</code>.
*/
public static void releaseSharedSegment(Segment segment) {
getSharedInstance().releaseSegment(segment);
}
--- 58,76 ----
return sharedCache;
}
/**
* A convenience method to get a Segment from the shared
! * {@code SegmentCache}.
*/
public static Segment getSharedSegment() {
return getSharedInstance().getSegment();
}
/**
* A convenience method to release a Segment to the shared
! * {@code SegmentCache}.
*/
public static void releaseSharedSegment(Segment segment) {
getSharedInstance().releaseSegment(segment);
}
*** 82,93 ****
public SegmentCache() {
segments = new ArrayList<Segment>(11);
}
/**
! * Returns a <code>Segment</code>. When done, the <code>Segment</code>
! * should be recycled by invoking <code>releaseSegment</code>.
*/
public Segment getSegment() {
synchronized(this) {
int size = segments.size();
--- 82,93 ----
public SegmentCache() {
segments = new ArrayList<Segment>(11);
}
/**
! * Returns a {@code Segment}. When done, the {@code Segment}
! * should be recycled by invoking {@code releaseSegment}.
*/
public Segment getSegment() {
synchronized(this) {
int size = segments.size();
< prev index next >