内容导航:
- 前言
- 1、java.text.DateFormat
- 2、java.util.Calendar
- 3、java.util.AbstractCollection
前言
在Java系统库中,有许多类被定义为抽象类,了解它们,以对抽象的概念加深理解。
1、java.text.DateFormat
官方源码:
package java.text;
public abstract class DateFormat extends Format {
public abstract StringBuffer format(Date date, StringBuffer toAppendTo,
FieldPosition fieldPosition);
public abstract Date parse(String source, ParsePosition pos);
//...
}
2、java.util.Calendar
官方源码:
package java.util;
public abstract class Calendar implements Serializable, Cloneable, Comparable<Calendar> {
protected abstract void computeTime();
protected abstract void computeFields();
abstract public void add(int field, int amount);
abstract public void roll(int field, boolean up);
//...
}
3、java.util.AbstractCollection
官方源码:
package java.util;
public abstract class AbstractCollection<E> implements Collection<E> {
/**
* Sole constructor. (For invocation by subclass constructors, typically
* implicit.)
*/
protected AbstractCollection() {
}
// Query Operations
/**
* Returns an iterator over the elements contained in this collection.
*
* @return an iterator over the elements contained in this collection
*/
public abstract Iterator<E> iterator();
public abstract int size();
//...
}
持续更新,欢迎留言提议!
码字很累,多点赞多赞赏!