2020-11-28 15:05:28 +01:00
|
|
|
package speiger.src.collections.utils;
|
|
|
|
|
2020-12-06 09:32:22 +01:00
|
|
|
/**
|
|
|
|
* Interface that allows to test for if a collection is trimmable.
|
|
|
|
* This also allows that synchronization-wrappers are trimmable without extracting the original collection.
|
|
|
|
*/
|
2020-11-28 15:05:28 +01:00
|
|
|
public interface ITrimmable
|
|
|
|
{
|
2020-12-06 09:32:22 +01:00
|
|
|
/**
|
|
|
|
* Trims the original collection down to the size of the current elements
|
|
|
|
*/
|
2020-11-28 15:05:28 +01:00
|
|
|
public default void trim() {
|
|
|
|
trim(0);
|
|
|
|
}
|
|
|
|
|
2020-12-06 09:32:22 +01:00
|
|
|
/**
|
|
|
|
* Trims the original collection down to the size of the current elements or the requested size depending which is bigger
|
|
|
|
* @param size the requested trim size.
|
|
|
|
*/
|
2020-11-28 15:05:28 +01:00
|
|
|
public void trim(int size);
|
|
|
|
}
|