如下代码中的<F>就是表示泛型,其实这个F可以用几乎任意的词替换,就像<T>一样,只是要前后一致就行了
package org.proninyaroslav.libretorrent.core.filetree;
/*
* The interface with basic functions for a file object.
*/
import java.io.Serializable;
public interface FileNode<F> extends Comparable<F>
{
class Type implements Serializable
{
public static int DIR = 0;
public static int FILE = 1;
}
String getName();
void setName(String name);
int getType();
void setType(int type);
@Override
int compareTo(F another);
}
还能这样写,好奇怪:
public class FileTree<F extends FileTree> implements FileNode<FileTree>, Serializable