首页 \ 问答 \ 有没有一个类似于Callable但有参数的接口?(Is there an interface similar to Callable but with arguments?)

有没有一个类似于Callable但有参数的接口?(Is there an interface similar to Callable but with arguments?)

Java中有一个类似于Callable接口的接口,可以接受它的调用方法的参数?

像这样:

public interface MyCallable<V> {
  V call(String s) throws Exception;
}

我宁愿避免创建一个新的类型,如果已经存在我可以使用的东西。 还是有更好的策略来让多个客户端实现并插入可调用例程?

从这里复制http://www.programmingforums.org/thread27905.html


Is there an interface in Java similar to the Callable interface, that can accept an argument to its call method?

Like so:

public interface MyCallable<V> {
  V call(String s) throws Exception;
}

I would rather avoid creating a new type if there already exists something that I can use. Or is there a better strategy to having multiple clients implement and plug in a callable routine?

Copied from here http://www.programmingforums.org/thread27905.html


原文:https://stackoverflow.com/questions/11083868
更新时间:2023-08-12 20:08

最满意答案

打开图形设备后应调用par函数,在本例中使用png完成。 所以你只需要移动那一行。


The par function should be called after you open the graphics device, which in this case is done with png. So you simply need to move that line.

相关问答

更多
  • 您可以使用facet_grid或facet_wrap按照因素分割图形。 ggplot(mydata, aes(Var1, Var2)) + geom_point() + facet_grid(~ Variety) 或者在单独的图上,只需使用一个简单的循环 for (var in unique(mydata$Variety)) { dev.new() print( ggplot(mydata[mydata$Variety==var,], aes(Var1, Var2)) + geom_poi ...
  • 我认为你对这个问题有类似的问题: 在matplotlib中栅格化多个元素 如在其中一个答案中 ,使用: ax = fig.add_subplot(111, rasterized=True) 或做: ax.set_rasterized(True) 然后,如果要稍微调整文件大小,可以设置图的分辨率: savefig(pdf, format='pdf', dpi=300) You have a similar problem to this question, I think: Rasterizing mu ...
  • 打开图形设备后应调用par函数,在本例中使用png完成。 所以你只需要移动那一行。 The par function should be called after you open the graphics device, which in this case is done with png. So you simply need to move that line.
  • 安排多个地块的一种方法是使用multipanelfigure封装。 创建示例图: library(ggplot2) plots <- list() for(i in 1:5) { plots[[i]] <- ggplot() + ggtitle(paste("My plot:", i)) } 为情节创建面板: library(multipanelfigure) figure <- multi_panel_figure(columns = 4, rows = 3, panel_label_type ...
  • 我想你已经有了答案。 你的最后一行返回一个错误,但是一个小的编辑会产生一个组合图,其中列内的宽度是相同的: g3 = do.call(rbind, c(list(g1,g2), size="first")) #combine g1 and g2 into a list 审美/参考的一个旁注: 如果你的X轴是相同的,你可以从顶部的两个图中删除它。 library(ggplot2); library(gridExtra); library(grid) # Tweak the margins to use up ...
  • 简单地把你的代码放到一个循环中,每次改变列名称和剧情名称都应该做到这一点(从快速测试它为我工作,我有3个PDF保存在我的工作目录中): import matplotlib.pyplot as plt import seaborn as sns for column in df.columns[1:]: # Loop over all columns except 'Location' sns.set() fig, ax = plt.subplots() sns.set(style ...
  • 在Plots.jl文档的属性部分中,有一个名为Subplot的部分。 在那里,你会发现可能对你有帮助的关键字margin , top_margin , bottom_margin , left_margin和right_margin 。 最小的工作示例是: using Plots, Measures pyplot() data = [rand(100), rand(100)]; histogram(data, layout = 2, title = ["Dataset A" "Dat ...
  • 粘贴代码非常有用。 看起来fill.contour的方式发生了变化,因为该代码首次发布。 改变线 .Internal(filledcontour(as.double(x), as.double(y), z, as.double(levels), col = col)) 至 .filled.contour(as.double(x), as.double(y), z, as.double(levels), col = col) 这样做我得到了情节 Pasting the co ...
  • 问题出在你的布局矩阵m : # [,1] [,2] [,3] [,4] #[1,] 1 2 3 4 #[2,] 5 6 7 8 #[3,] 9 10 9 10 在最后一行中,您有9, 10, 9, 10而不是9, 9, 10, 10 。 使用 m <- cbind(c(1,5,9), c(2,6,9), c(3,7,10), c(4,8,10)) 代替。 我想让最后一行中的两个图在中心对齐,与其他图的长度和宽度相同。 通过保留相 ...
  • 如评论中所述,您可以提供频率响应阵列作为MIMO系统的输入输出响应。 让我们伪造一些3x4x100的复数,伪造一系列频率,然后画出Bode A = rand(3,4,1000); A = A + (rand(3,4,1000)-0.5)*1i; w = logspace(-2,2,1000); G = frd(A,w); bode(G) 您可以从具有幅度和相位角的r*exp(i \theta)的极坐标表示的磁/相位阵列中再次获得复矢量。 编辑 f1=[1,10,100,1000]; amp1=[12,56 ...

相关文章

更多

最新问答

更多
  • 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
  • 如何通过引用返回对象?(How is returning an object by reference possible?)
  • 矩阵如何存储在内存中?(How are matrices stored in memory?)
  • 每个请求的Java新会话?(Java New Session For Each Request?)
  • css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
  • 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
  • xcode语法颜色编码解释?(xcode syntax color coding explained?)
  • 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
  • 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
  • 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
  • 西安哪有PLC可控制编程的培训
  • 在Entity Framework中选择基类(Select base class in Entity Framework)
  • 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
  • 电脑二级VF有什么用
  • Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
  • 金华英语角.
  • 手机软件如何制作
  • 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
  • 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
  • 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
  • Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
  • 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
  • python的访问器方法有哪些
  • DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
  • 在Ruby中对组合进行排序(Sorting a combination in Ruby)
  • 网站开发的流程?
  • 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
  • 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
  • 透明度错误IE11(Transparency bug IE11)
  • linux的基本操作命令。。。