package org.test.toolkit.file;
public interface FileType {
public enum Image implements FileType {
JPG;
public String toString() { //duplicated code
return "." + super.toString().toLowerCase();
};
}
public enum Office implements FileType {
DOC;
public String toString() {
return "." + super.toString().toLowerCase();
};
}
public enum PlainText implements FileType {
TXT;
public String toString() { //duplicated code
return "." + super.toString().toLowerCase();
};
}
}
How to efficiently remove duplicate code. Perhaps i should consider using a static method defined in other class object? Or is there a better way to solve my problem?
public String toString() {
return "." + super.toString().toLowerCase();
};
相关推荐
Using practical examples based on Eclipse, he also shows how tools can help you work more efficiently, save you time, and sometimes even write high-quality code for you. Gast writes for developers ...
DDR4接口分析是现代高速数字设计中的一个关键环节,特别是在高性能计算和数据中心应用中。Cadence公司的DDR4接口分析课程提供了深入理解如何有效地处理这一挑战的途径。在2015年的MemCon会议上,Taranjit Kukal和...
How to perform large scale operations efficiently
How to read a book efficiently. Part one The dimensions of reading Part two The third level of reading Part three Approaches to different kinds of reading Part four The ultimate goals of reading
By utilizing recent results on convergence of graph Laplacian eigenvectors to the Laplace-Beltrami eigenfunctions of manifolds, we show how to efficiently calculate the code of a novel data-point....
Learn how to efficiently read and write data in R Dive into data carpentry—the vital skill for cleaning raw data Optimize your code with profiling, standard tricks, and other methods Determine your ...
How to thread efficiently and robustly How C# anonymous types, lamba expressions, and extension methods work and how to use them Who is this book for? If you're an experienced C# programmer, you...
You will not only learn about group-wise data manipulation, but also learn how to efficiently handle date, string, and factor variables along with different layouts of datasets using the reshape2 ...
Test existing JavaScript code using JSLint and understand how to better optimize JavaScript code Create your own build system for JavaScript projects using Node.js and GulpJS Get to know best ...
SharePoint® 2010 How-To Ishai Sagi Real Solutions for SharePoint 2010 Users Need fast, reliable, easy-to-implement solutions for SharePoint 2010? This book delivers exactly what you’re looking ...
How to thread efficiently and robustly How to use the C# 2008 anonymous types, lamba expressions, and extension methods Who is this book for? If you're an experienced C# programmer, you need to ...
The aim is to provide the benefits of reactive data binding and composable view components with an API that is as simple as possible., This book will teach you how to efficiently implement Vue.js in ...
* How to thread efficiently and robustly * How C# anonymous types, lamba expressions, and extension methods work and how to use them Who is this book for? If you’re an experienced C# programmer, you...
Learn steps and tasks to help a NetSuite administrator perform both his daily and monthly tasks efficiently. Advance his expertise to become NetSuite leader without having to spend time and money on ...
You will learn everything you need to know in order to use OpenShift to develop and deploy applications in the cloud as well as how to deploy your very own OpenShift Origin-based Platform-as-a-Service...
《Working Effectively with Legacy Code》是一本由Michael Feathers所著的经典书籍,专注于如何在已有大量遗留代码的项目中进行高效、安全的修改和维护。这本书对于任何在IT行业中处理旧代码库或需要升级现有系统的...