Java tree data

Is there a good available (standard Java) data structure to represent a tree in Java? Specifically I need to represent the following: The tree at any node can have an arbitrary number of children Each node (after the root) is just a String (whose children are also Strings) I need to be able to get all the children (some sort of list or array of Strings) given an input string representing

Java树数据

是否有一个好的可用(标准Java)数据结构来表示Java中的树? 具体而言,我需要表示以下内容: 任何节点上的树都可以有任意数量的子节点 每个节点(在根之后)只是一个String(其子节点也是Strings) 我需要能够得到所有的孩子(某种列表或字符串数​​组),给定一个表示给定节点的输入字符串 有没有可用的结构或我需要创建自己的(如果这样的实施建议会很好)。 这里: public class Tree<T> { private Nod

Java code optimization tips and tricks

Specifically looking for Java code tips and tricks of the trade for: reducing memory footprint increasing performance Personally would like to see answers focusing on the "how" and not the "when" as the consensus among savvy developers is that early optimization is a bad idea as you don't have anything to profile and thus don't know what the actual bottlenecks wi

Java代码优化技巧和窍门

具体查找Java代码提示和技巧的交易: 减少内存占用 提高性能 个人希望看到关于“如何”而不是“何时”的答案,因为精明的开发人员之间的共识是早期优化是一个坏主意,因为你没有任何东西要分析,因此不知道实际是什么瓶颈将会发生。 “我们应该忘记小效率,大约97%的时间:不成熟的优化是所有邪恶的根源” “在已建立的工程学科中,容易获得的12%的改进永远不会被认为是边际的,我相信软件工程中应该采用相同的观点” 唐纳

Speeding Up Java

This is really two questions, but they are so similar, and to keep it simple, I figured I'd just roll them together: Firstly : Given an established Java project, what are some decent ways to speed it up beyond just plain in-code optimization? Secondly : When writing a program from scratch in Java, what are some good ways to greatly improve performance? Please stay away from general opti

加速Java

这实际上是两个问题,但它们非常相似,为了简单起见,我想我会把它们放在一起: 首先 :给定一个已建立的Java项目,有什么体面的方法可以加速超越简单的代码内优化? 其次 :在Java中从头开始编写程序时,有什么方法可以大大提高性能? 除非特定于Java,否则请远离一般优化技术。 我之前曾问过关于Python和Perl的内容。 对于Java,我想知道有什么好的提示/技巧来提高性能,以及是否有任何特别好的Java分析器。 首先:

Dynamically force transition in Spring Web Flow

Spring web flow is a state machine of sorts for a user interacting with html pages. Traditionally, while a user is in a view state the system will wait until the user interacts with the page which will trigger some transition. Is it possible to force a transition or update a page without interaction from the user in spring web flow? For example, I may have a REST controller, or an AMQP listen

Spring Web Flow中的动态强制转换

Spring Web Flow是一种用于与HTML页面交互的用户的状态机器。 传统上,当用户处于视图状态时,系统将等待用户与页面进行交互,这将触发一些转换。 在Spring Web Flow中,是否可以强制转换或更新页面而无需用户进行交互? 例如,我可能有一个REST控制器或一个AMQP监听器,或者甚至可能只是一些后台进程正在运行。 当数据来自这些独立流程之一时,我想将用户更新为新的转换。 例如,用户坐在决策点一段时间,另一个服务将通

Spring Web Flow config for SpringFramework 3.0 or alternatives?

I would like to know, whether spring web flow supports springframework 3 release. According to the official documentation http://static.springsource.org/spring-webflow/docs/2.3.x/reference/html/ch10s02.html, spring 2.5 is used (config file), but as was mentioned stackoverflow:spring-3-spring-web-flow-2-dependencies-problem it should work with the springframework 3, so does it mean documentation

SpringFramework 3.0的Spring Web Flow配置还是其他选择?

我想知道,春季web流程是否支持springframework 3发布。 根据官方文档http://static.springsource.org/spring-webflow/docs/2.3.x/reference/html/ch10s02.html,使用了spring 2.5(配置文件),但正如提到的那样:stackoverflow:spring- 3-spring-web-flow-2-dependencies-它应该与springframework 3一起工作,所以它意味着文档不是最新的,对于spring web flow样本也是如此,其中也使用spring 2.5。 所以,如果它支持,正确

How to schedule a periodic task in Java?

I need to schedule a task to run in at fixed interval of time. How can I do this with support of long intervals (for example on each 8 hours)? I'm currently using java.util.Timer.scheduleAtFixedRate . Does java.util.Timer.scheduleAtFixedRate support long time intervals? 使用ScheduledExecutorService: private final ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1);

如何在Java中安排定期任务?

我需要安排一个任务以固定的时间间隔运行。 我如何在长时间间隔(例如每8小时)支持下做到这一点? 我目前正在使用java.util.Timer.scheduleAtFixedRate 。 java.util.Timer.scheduleAtFixedRate是否支持长时间间隔? 使用ScheduledExecutorService: private final ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1); scheduler.scheduleAtFixedRate(yourRunnable, 8, 8, TimeUnit.HOURS); 你应

Strategies for handling repetitive background tasks in a Java web application?

I'm building a personal Web application using Java EE 6 Technologies (the container is an application server, Jboss AS 7). I'm starting from scratch to create repetitive background tasks, I identified two possible scenarios : Scheduled tasks (eg, sending bulk mails every sunday night) Trigger tasks based on web event (eg,running some long background updates from a web action) What

在Java Web应用程序中处理重复后台任务的策略?

我正在使用Java EE 6技术构建个人Web应用程序(容器是应用程序服务器,Jboss AS 7)。 我从头开始创建重复的后台任务,我确定了两种可能的情况: 计划任务(例如,每周日晚上发送大量邮件) 基于Web事件触发任务(例如,从Web操作运行一些较长的后台更新) 我想避免的(我不知道是否可行)是让我的platformm散布一些背景任务(其中一些使用cron,其他使用TimerTask,db作业等)变得难以维护。 考虑到以前的两个要求,在

Eclipselink problem in a javase project

I am getting this error when I am running my eclipselink project. [EL Warning]: 2008.12.05 11:47:08.056--java.lang.NoClassDefFoundError: org/jboss/resource/adapter/jdbc/ValidConnectionChecker was thrown on attempt of PersistenceLoadProcessor to load class com.mysql.jdbc.integration.jboss.MysqlValidConnectionChecker. The class is ignored. Exception in thread "main" java.lang.NoClassDefFoundErro

Eclipselink问题在一个javase项目中

我在运行我的eclipselink项目时遇到此错误。 [EL Warning]: 2008.12.05 11:47:08.056--java.lang.NoClassDefFoundError: org/jboss/resource/adapter/jdbc/ValidConnectionChecker was thrown on attempt of PersistenceLoadProcessor to load class com.mysql.jdbc.integration.jboss.MysqlValidConnectionChecker. The class is ignored. Exception in thread "main" java.lang.NoClassDefFoundError: org/jboss/resource/ad

How can I lookup a Java enum from its String value?

I would like to lookup an enum from its string value (or possibly any other value). I've tried the following code but it doesn't allow static in initialisers. Is there a simple way? public enum Verbosity { BRIEF, NORMAL, FULL; private static Map<String, Verbosity> stringMap = new HashMap<String, Verbosity>(); private Verbosity() { stringMap.put(this.t

我如何从它的字符串值查找Java枚举?

我想从它的字符串值(或可能的任何其他值)查找枚举。 我试过下面的代码,但它不允许在初始化程序中使用静态代码。 有一个简单的方法吗? public enum Verbosity { BRIEF, NORMAL, FULL; private static Map<String, Verbosity> stringMap = new HashMap<String, Verbosity>(); private Verbosity() { stringMap.put(this.toString(), this); } public static Verbosity getVerbo

Execution order of of static blocks in an Enum type w.r.t to constructor

This is from Effective Java : // Implementing a fromString method on an enum type private static final Map<String, Operation> stringToEnum = new HashMap<String, Operation>(); static { // Initialize map from constant name to enum constant for (Operation op : values()) stringToEnum.put(op.toString(), op); } // Returns Operation for string, or null if string is

将Enum类型wrt中的静态块的执行顺序传递给构造函数

这来自Effective Java: // Implementing a fromString method on an enum type private static final Map<String, Operation> stringToEnum = new HashMap<String, Operation>(); static { // Initialize map from constant name to enum constant for (Operation op : values()) stringToEnum.put(op.toString(), op); } // Returns Operation for string, or null if string is invali