在我正在编写的程序中,我试图获取给定季节的格式化季节名称(格式化后的格式。我将格式化名称保留在界面中,因为如果要使用地图,它将被不必要地重新生成,因为我没有创建TeamBuilder的实例
季节界面:
public interface Seasons {
/*
* Contains a formatted list of seasons.
*
* An interface is being used as an alternative to using a Map in the
* TeamBuilder class, since calling parseTeam would have to build
* mappings for the seasons each time it
* was called. This way, the formatted name can simply be grabbed
*/
final String Skyrise = "Skyrise";
final String Toss_Up = "Toss%20Up";
final String Sack_Attack = "Sack%20Attack";
final String GateWay = "Gateway";
final String Round_Up = "Round%20Up";
final String Clean_Sweep = "Clean%20Sweep";
final String Elevation = "Elevation";
final String Bridge_Battle = "Bridge%20Battle";
final String Nothing_But_Net = "Nothing%20But%20Net";
final String Starstruck = "Starstruck";
final String In_The_Zone = "In%20The%20Zone";
final String Turning_Point = "Turning%20Point";
}
当我尝试抓住这些季节时,问题就来了。我的TeamBuilder类接受一个无格式的参数(字符串季节)。我的问题是,有什么方法可以使用String参数作为方法从接口获取特定项?这是使用HashMap最可取的方法,因为HashMap会不必要地重新生成相同的信息
BIG阳
ibeautiful
相关分类