- 浏览: 76756 次
文章分类
- 全部博客 (89)
- web service (9)
- subversion (1)
- JBOSS (3)
- interview (23)
- jQery (2)
- ExtJs (0)
- Axis (0)
- Design pattern (3)
- Agile (2)
- mutithread (0)
- Core Java (24)
- programming methods (1)
- SSH (7)
- jee design (1)
- OO (4)
- books (8)
- other (1)
- JSF (7)
- seam (2)
- Weblogic (4)
- JPA (1)
- ADF (1)
- Spring (5)
- Tomcat (1)
- DWR (2)
- JEE (3)
- Servlet (1)
- EJB (1)
- JDBC (3)
最新评论
-
iloveflower:
呵呵。好好学习。。。。。。。。。。。。
java 读书 -
Eric.Yan:
看了一点,不过是电子版的……你这一说到提醒我了,还要继续学习哈 ...
java 读书
How can I fill a multidimensional array in Java without using a loop? I've tried: double[][] arr = new double[20][4]; Arrays.fill(arr, 0); This results in java.lang.ArrayStoreException: java.lang.Double Thanks in advance! Another way to do this without a loop is to use tail recursion. Yes, it is kind of silly and no one would use it in practice either, but it does show, maybe, that loops are fine in this case. Nevertheless, just to show "yet another loop free example" and to have fun, here is: import java.util.Arrays; public class FillExample { private static void fillRowsWithZeros(double[][] a, int rows, int cols) { if (rows >= 0) { double[] row = new double[cols]; Arrays.fill(row, 0.0); a[rows] = row; fillRowsWithZeros(a, rows - 1, cols); } } public static void main(String[] args) { double[][] arr = new double[20][4]; fillRowsWithZeros(arr, arr.length - 1, arr[0].length); System.out.println(Arrays.deepToString(arr)); } } It isn't pretty, but in answer to the OP's question, there are no explicit loops.
发表评论
-
Java Collection summary
2012-06-16 02:40 534Collection:List、Set Map: ... -
When to use Comparable vs Comparator
2012-06-15 00:52 748I have a list of objects I need ... -
Immutable objects
2012-06-14 23:49 666Immutable objects are simply ... -
Implementing hashCode; Transaction.java
2012-06-14 23:43 785Below is the syntax highlight ... -
Lazy initialization
2012-06-14 22:48 764http://www.javapractices.com/to ... -
How to sort an array,mid of linkedlist, reverse int
2012-06-13 07:47 888A common mistake for a beginner ... -
Java各类型转换
2012-06-13 05:25 663各种数字类型转换成字符串型: String s = Str ... -
regular expression
2012-06-13 03:08 4751、Java对反斜线处理的 ... -
string functions
2012-06-13 00:09 786import java.util.*; public c ... -
String array to arraylist
2012-06-13 00:07 538There are some important thing ... -
core java interview summary
2012-06-12 04:11 344http://blog.sina.com.cn/s/blog_ ... -
programming with String
2012-06-12 01:43 522Question: 1) Write code to che ... -
OO Design books -good website
2012-06-07 03:13 658I’m always on the search on goo ... -
Write a String Reverser (and use Recursion!)
2012-06-07 03:03 489Java Interview questions: Write ... -
Java高手必会的要点
2012-05-29 03:28 579http://developer.51cto.com/art/ ... -
How to use getClass().getClassLoader().getResource()
2012-05-29 03:13 1709This is the simplest wat to get ... -
How to override equals method in Java
2012-05-12 02:57 1509Object class holds some very in ... -
Top 30 Programming interview questions
2012-05-12 02:48 873Programming questions are integ ... -
10 example of using ArrayList in Java >>> Java ArrayList Tutorial
2012-05-12 02:37 812ArrayList in Java is most frequ ... -
How to use Comparator and Comparable in Java? With example
2012-05-12 02:21 735Read more: http://javarevisited ...
相关推荐
Gain an in-depth understanding of PHP 7 arrays. After a quick overview of PHP 7, each chapter concentrates on single, multi-dimensional, associative, and object arrays. PHP Arrays is a first of its ...
Apress.PHP.Arrays.Single.Multi-dimensional.Associative.and.Object.Arrays.in.PHP.7.1484225554.rar 最新书籍,精讲PHP数组,文字版PDF
个人研究所得,包含对其内部jdk源码的分析。 同时会结合ArrayList中对该两个方法的调用做进一步说明。...总结一句话:在允许的情况下,尽量调用System.arraycopy方法,实在不行再调用Arrays.copyOf方法。
Arduino项目开发 Control_Arrays_Arrays.pdf Arduino项目开发 Control_Arrays_Arrays.pdf Arduino项目开发 Control_Arrays_Arrays.pdf Arduino项目开发 Control_Arrays_Arrays.pdf Arduino项目开发 Control_Arrays_...
Java Methods-Arrays.ppt
本文主要对Arrays.asList方法进行总结。具有很好的参考价值,下面跟着小编一起来看下吧
主要介绍了Java Arrays.sort和Collections.sort排序实现原理解析,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧
Antenna Arrays.pdf
Arrays in Java .............................. 44 You never need to destroy an object .................. 45 Scoping ........................................ 45 Scope of objects ...........................
主要介绍了JAVA基于Arrays.sort()实现数组升序和降序,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友可以参考下
Using Java Arrays Chapter 5. Using Loops in Java Code Chapter 6. Encapsulating Data and Exposing Methods in Java Chapter 7. Using Java Methods to Communicate Chapter 8. Using Java Constructors ...
网络图片地址url集合arrays.xml文件
Java语言程序设计基础篇课后题答案-Chapter6Arrays.pdf
Calculate the mutual impedance in an infinite phased arrays.
Introducing Structures and Cell Arrays.zip
NULL 博文链接:https://128kj.iteye.com/blog/1747459
[U.Meyer-Baese]Digital Signal Processing with Field Programmable Gate Arrays.3rd Ed
主要介绍了Java Arrays.asList使用方法解析,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友可以参考下
数据结构严蔚敏chapter2arrays.ppt